Jump to content

Feedback form error


drkillpatient

Recommended Posts

Hello all,

I'm using this feedback form for a friend's website, but I'm having some problems with it. This is the problem:

The contactus.php file should use feedback.php to email feedback from the site and then route the browser to thankyou.php or error.php (if there's an error with the form). However, when I try to submit the feedback I get this error:

*" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer:
chfeedback.php 2.07" ); header ("Location: contactUS.php?fns=1"); ?>*

I can't see anything wrong with the code in feedback.php. If anyone could take a quick look and maybe diagnose the problem for me that would be brilliant. Or if anyone has code for a working php feedback form that would be even better. Thanks in advance!

PS. Here's a link to the zip file containing the 4 files: download.yousendit.com/BCDE1B0713D43ED2
Link to comment
https://forums.phpfreaks.com/topic/33405-feedback-form-error/
Share on other sites

Feedback.php

[code]
<?


// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "[email protected]" ;

$mailto = '[email protected]' ;

// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;

$subject = "Feedback Form" ;

// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;

$formurl = "http://www3.unl.ac.uk:8008/~fmn007/MM3010/PHP/contactUS.php" ;
$errorurl = "http://www3.unl.ac.uk:8008/~fmn007/MM3010/PHP/error.php" ;
$thankyouurl = "http://www3.unl.ac.uk:8008/~fmn007/MM3010/PHP/thankyou.php" ;

$uself = 0;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
  header( "Location: $errorurl" );
  exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33405-feedback-form-error/#findComment-156573
Share on other sites

Contactus.php

[code]
<form action="feedback.php" method="post">
              <table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
                <tr>
                  <td>Name:</td>
                  <td>
                    <input type="text" name="name" size="25" />
                  </td>
                </tr>
                <tr>
                  <td>Email address:</td>
                  <td>
                    <input type="text" name="email" size="25" />
                  </td>
                </tr>
                <tr>
                  <td colspan="2"> Comments<br />
                    <textarea rows="15" cols="45" name="comments"></textarea>
                  </td>
                </tr>
                <tr>
                  <td align="center" colspan="2">
                    <input type="submit" value="Send Feedback" />
                    <br />
                  </td>
                </tr>
              </table>
            </form>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33405-feedback-form-error/#findComment-156574
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.