Jump to content

Recommended Posts

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/contact_error.html" ;
$thankyouurl = "http://www.***.us/contact_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!
Link to comment
https://forums.phpfreaks.com/topic/12639-php-form-to-mail-issues/
Share on other sites

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

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

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

ya simple is sometimes better!
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.