KeybladeSephi
New Member
- Messages
- 19
- Reaction score
- 0
- Points
- 0
Alright guys, I bet you've seen a lot of these and I'm sorry if it's getting a little redundant (it's not my fault!). Basically, my contact form is fine, but after I tested it, it had an error: "Warning: Cannot modify header information - headers already sent by (output started at /home/keyblade/public_html/contact.php:3) in /home/keyblade/public_html/contact.php on line 27". However, the email is still successfully sent to me. Here's my contact form and here is a screenshot of my problem. Here is the code from my "contact.php" document:
Line 27 is " header("Location: http://keybladesephi.exofire.net"); /* Redirect browser */ "
If anyone can help me, that'd be greatly appreciated; +1 rep =]
HTML:
<link rel="stylesheet" href="../css/main.css" />
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments_or_questions'];
$valid_email = false;
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
{
$valid_email=true;
}
if(!$name or !$comments or ($valid_email==false))
{
echo ("You didn't fill in all the required fields.<br />Please <a href=\"javascript:history.back()\">return</a> to the previous page and try again.");
}
else
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";
$headers .= 'Reply-To: '.$email. "\r\n";
mail("KeybladeSephi@netscape.net","Email From Site", stripslashes($comments), $headers);
header("Location: http://keybladesephi.exofire.net"); /* Redirect browser */
}
?>
Line 27 is " header("Location: http://keybladesephi.exofire.net"); /* Redirect browser */ "
If anyone can help me, that'd be greatly appreciated; +1 rep =]