5 Replies Latest reply on Jul 19, 2010 6:54 AM by MergeThis

    Feedback form script in RH8

    Jop Smith Level 1

      My form (see below) triggers a PHP script (see below) which is supposed to send the form data to my email address. It works perfectly in a regular web page, but when I've integrated into my WebHelp project the form fails to send anything and show a series of PHP errors (see below). I'm no PHP expert so I'd be grateful if anyone could advise me or suggest an alternative method of producing a Feedback Form in a WebHelp page.

       

      FORM:

       

      <form action="sendmail.php" method="post" name="Feedback" id="Feedback">
        <p><strong style="font-weight: bold;">Name</strong>:<br />
          <input name="name" type="text" id="Name" class="fields" size="30" />
        </p>
        <p><strong style="font-weight: bold;">Email</strong>:<br />
          <input name="email" type="text" id="Email" class="fields" size="30" />
        </p>
        <p><strong style="font-weight: bold;">Phone</strong>:<br />
          <input name="phone" type="text" id="Phone" class="fields" size="30" />
        </p>
        <p><strong style="font-weight: bold;">Firm</strong>:<br />
          <input name="firm" type="text" id="Firm" class="fields" size="30" />
        </p>
        <p><strong style="font-weight: bold;">Comments</strong>:<br />
          <textarea name="message" cols="60" rows="5"></textarea>
        </p>
        <p>
          <input name="Clear" type="reset" class="button" value="Clear" />
          <input
        name="Send" type="submit" class="button" id="Send" value="Send" />
        </p>
      </form>

       

      SCRIPT:

       

      <?
      $name = $_REQUEST['name'] ;
      $email = $_REQUEST['email'] ;
      $phone = $_REQUEST['phone'] ;
      $firm = $_REQUEST['firm'] ;
      $message = $_REQUEST['message'] ;
      $http_referrer = getenv( "HTTP_REFERER" );

      $messagelayout =

      "This message was sent from:\n" .
      "$http_referrer\n" .
      "\n" .
      "\n" .
      "SENDER------------------------------------------------------\n\n" .
      "Name: $name\n" .
      "Email: $email\n" .
      "Phone: $phone\n" .
      "Firm: $firm\n" .
      "\n" .
      "MESSAGE-----------------------------------------------------\n\n" .
      $message .
      "\n\n------------------------------------------------------------\n" ;

      if (!isset($_REQUEST['email'])) {
      header( "Location: feedback.htm" ) ;
      }
      elseif (empty($name) || empty($email) || empty($phone) || empty($firm) ||empty($message)) {
      header ( "Location: error.htm" ) ;
      }
      else {
      mail( me@work.co.uk, "Documentation Feedback", $messagelayout, "From: $name <$email>" ) ;
      header( "Location: thanks.htm" ) ;
      }

      ?>

       

      ERRORS:

       

      Warning: Undefined variable: _REQUEST in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 2

       

      Warning: Undefined variable: _REQUEST in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 3

       

      Warning: Undefined variable: _REQUEST in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 4

       

      Warning: Undefined variable: _REQUEST in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 5

       

      Warning: Undefined variable: _REQUEST in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 6

       

      Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php:2) in C:\Inetpub\wwwroot\Documentation (ILE)\WebHelp\Working\sendmail.php on line 26

        • 1. Re: Feedback form script in RH8
          Captiv8r Adobe Community Professional & MVP

          Hi there

           

          I see all manner of references to your  local C drive. Normally PHP is something handled on a web server  connected to the internet. So you probably need to upload the content to  a web server before the test will work.

           

          Cheers... Rick 

           

           

           

          Helpful and Handy Links

          RoboHelp Wish Form/Bug Reporting Form

          Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!

          Adobe Certified RoboHelp HTML Training

          SorcerStone Blog

          RoboHelp eBooks

          • 2. Re: Feedback form script in RH8
            Willam van Weelden Adobe Community Professional & MVP

            Hi,

             

             

             

            Php is a server side script. Therefore, you need to run the script on a server with php support. You can install a package to run scripts on your localhost. (EasyPHP is an easy to use, free tool.) To send mail with php, your server has to be configured to do this. Since the script works on a regular page, I think that your problem is related to the settings of the server you use.

             

             

             

            Since the method of the form is ‘post’, you can change $_REQUEST to $_POST. But is should not have anything to do with you problem.

             

             

             

            For more information on php, you better check php.net<http://php.net/>, or a php forum.

             

             

             

            Greet,

             

             

             

            Willam

             

             

             

             

             

            This e-mail is personal. For our full disclaimer, please visit www.centric.eu/disclaimer.

            • 3. Re: Feedback form script in RH8
              Jop Smith Level 1

              Ok, thanks. I'll get my System Administrator to check out the server settings.

              • 4. Re: Feedback form script in RH8
                Jop Smith Level 1

                Hi Guys, just got round to looking at this again.

                 

                The form now sends the email, but my "thank you" page isn't displayed. Also, if the required fields are not completed, my "error" page isn't displayed either.

                 

                I'm testing this form after it's been published to our web server, which is on the same server as our intranet and the forms on the intranet work fine using the same script. I'm convinced that RoboHelp is doing something weird with the script.

                 

                Any further help would be much appreciated.

                 

                Thanks

                Jonathan

                • 5. Re: Feedback form script in RH8
                  MergeThis Level 4

                  If you don't mind switching to JavaScript instead of php, here's what we use:

                   

                  IN THE TOPIC:

                   

                  <!--(HR)
                  ============================================================-->
                  <?rh-cbt_start condition="Online" ?><hr style="color: #d9e4da; background-color: #d9e4da;"
                             width="300" align="center" /><?rh-cbt_end ?>
                  <?rh-cbt_start condition="Online" ?><p align="center"><?rh-cbt_start condition="Online" ?><a
                    href="#">Return to top</a><?rh-cbt_end ?> &#160;<?rh-cbt_start condition="Online" ?>&#160;<?rh-cbt_end ?><?rh-cbt_start condition="Online" ?><span
                    style="color: #1c4598; font-size: 10pt;">|</span><?rh-cbt_end ?> &#160;<script
                    src="<relative_path>/feedback_script.js" language="javascript" type="text/javascript"
                    style="x-condition: Online;"></script></p><?rh-cbt_end ?>

                   

                  CONTENTS OF feedback_script.js FILE:

                   

                  var mailSubject = 'Online Help Vx.x.x Comment';
                  var mailBody = '[Enter comments here] \n\nMy comments apply to this page: ' + location.href;
                  var mailDisplay = 'Feedback on this page';
                  document.write(
                  '<a href="mailto:docfolks@xyz.org'
                  + '?subject=' + escape(mailSubject)
                  + '&body=' + escape(mailBody)
                  + '">' + mailDisplay + '</a>');