Skip to main content
Inspiring
April 23, 2010
Question

Feedback form script in RH8

  • April 23, 2010
  • 2 replies
  • 1354 views

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

This topic has been closed for replies.

2 replies

Willam van Weelden
Inspiring
April 23, 2010

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.

Jop_SmithAuthor
Inspiring
April 28, 2010

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

Jop_SmithAuthor
Inspiring
July 16, 2010

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

Captiv8r
Legend
April 23, 2010

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