Jump to content


Photo

PHP form to MAIL issues


  • Please log in to reply
4 replies to this topic

#1 GregL83

GregL83
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts

Posted 22 June 2006 - 03:15 PM

Hello, I am adding a PHP form to mail script to my contacts page of my website. I used a script generator from thesitewizard.com; however, I am getting an error message when I try and test it out. The message is as follows:
"The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log."
I can't find the error log or seem to be able to fix the problem. My web host is powweb and they have: PHP4 & PHP5 w/Zend Optimizer, Perl5, Sendmail listed as supported software.
here is my .php file's code:
<?
$mailto = 'Langla79@erau.edu' ;
$subject = "YourScene Message" ;
$formurl = "http://www.***.us/contact.html" ; //note I blanked out website for privacy, thanks
$errorurl = "http://www.***.us/co...act_error.html" ;
$thankyouurl = "http://www.***.us/co...ct_thanks.html" ;
$uself = 0;
$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 ;
?>

Here is my code from the form:
<form action="data/contact.php" method="post" name="Comments" id="Comments"><div align="center">
<p><span class="style3">Full Name:</span>
<input name="name" type="text" id="full_name" maxlength="25">
<span class="style3">Email:</span>
<input name="email" type="text" maxlength="25">
</p>
<p><span class="style3">Message</span><br>
<textarea name="comments" cols="50" rows="7"></textarea>
</p>
</div>
</label>
<label> </label>
<div align="center">
<input name="Submit" type="submit" value="Send">
<input type="reset" name="Submit2" value="Reset">
</label>
</div>
<label></label>
</form></td>


PLEASE HELP!!!! Thank you for your time!

#2 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 22 June 2006 - 05:28 PM

Try just changing this:
mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

to this
mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>);


#3 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 22 June 2006 - 05:34 PM

[!--quoteo(post=386902:date=Jun 22 2006, 12:28 PM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ Jun 22 2006, 12:28 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try just changing this:
mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

to this
mail($mailto, $subject, $messageproper,"From: \"$name\" <$email>);
[/quote]

ya simple is sometimes better!
"Syntax error" .. WHERE THE **** IS IT?!

#4 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 22 June 2006 - 05:38 PM

Yeah...it's an easy debugger...take out all of the extra crap that you don't really need. If it works you are good and start adding stuff back on, if it doesn't, leave that part simple and look at something else.

#5 GregL83

GregL83
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts

Posted 22 June 2006 - 05:38 PM

I came up with the same error....thanks for the attempt




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users