|
have a php form that works perfectly, then i wanted to set it up to do a redirect after the form is processed, but i am having a hard time getting it so work: I used the header function with no luck,. I researched online and it stated that the header function must not have whitepaces before it or a echo statement. I have a check setup so that if a user leave info blacnk it will print a message to the screen. So how do I have it check and if it passess the check then my the user be redirect to another page.
listed below is the script
<?php
if($_POST[check]== "true") {
$errmsg="";
if ($_POST[sender_name]== "") {
$errmsg .= "<font color=red>Enter your name</font><BR />";
}
if ($_POST[sender_email]== "") {
$errmsg.= "<font color=red>Enter your email</font><BR />";
}
if ($_POST[sender_phone]== "") {
$errmsg.= "<font color=red>Enter your phone number</font><BR />";
}
if ($_POST[OS]== "") {
$errmsg.= "<font color=red>Enter your Operating System</font><BR />";
}
if ($_POST[message]== "") {
$errmsg.= "<font color=red>Please, give us a description of your problem</font><BR />";
}
if ($errmsg!="") {
echo $errmsg;
}
else
$to = "support@nucitytech.com";
$msg = "Sender's Name: $_POST[sender_name]\n";
$msg .= "Sender's Email:$_POST[sender_email]\n";
$msg .= "Sender's Phone: $_POST[sender_phone]\n";
$msg .= "Sender's OS:$_POST[OS]\n";
$msg .= "Message: $_POST[message]\n";
$subject = "From: NuCityTech Website";
$mailheaders = "From: Nucitytech Support Page\n";
$mailheaders .= "Reply-To:$_POST[sender_email]\n";
mail($to, $subject, $msg, $mailheaders);
header("Location: services.html");
}
?>
Any thoughts?
Last edited by cedtech23 : 07-10-2004 at 11:53 AM.
Reason: Where to place header function
|