How can I call another page once error checking is complete? Right now I have a form that calls itself by using this action to then perform the error checking:
<form method=post action="/order.php" name="orderForm">
This is some of the error checking code I'm using:
php:
<?php
if (isset($POST['been_submitted'])=="YES") {
if ($POST['firstName']) {
$a = TRUE;
} else {
$a = FALSE;
$message[] = "First Name required";//this is the error message
}
if ($POST['lastName']) {
$b = TRUE;
} else {
$b = FALSE;
$message[] = "Last Name required";//this is the error message
}
if ($POST['addr']) {
$c = TRUE;
} else {
$c = FALSE;
$message[] = "Street Address required";//this is the error message
}
}
if ($a and $b and $c)
{//if pass the test.
header("Location: http://www.whatnott.com/step2.html");
}
Of course, if no errors are found I want it to go to step 2 of the form and pass all variables in hidden fields. I did have it set up to email me all the information by using this:
php:
if ($a and $b and $c)
{//if pass the test.
$myemail="order@whatnott.com";
$subject="new order";
$header = "From: $_POST[email]\r\n";
$header .= "X=Mailer: PHP/";
$body="Order Information:
IP Address:
" . $HTTP_SERVER_VARS['REMOTE_ADDR'] . "
Contact Information:
First Name: $POST[firstName]
Last Name: $POST[lastName]
Street Address: $POST[addr]
Apt: $POST[apt]
City: $POST[city]
State: $POST[state]
Zip: $POST[zip]
Country: $POST[country]
Phone: $POST[phoneNum]
Email: $POST[email]
Email Verified: $_POST[verifyEmail]
mail ($myemail, $subject, $body, $header);
}
?>
At that point I had it print to the screen that everything was successful. This old way works perfectly, but I want to do it in steps instead of having everything on one page and then on the final page send all of the info to our credit card processing company. But I cannot get it to send me to the next step let alone send the info over a gateway to our processor.
The header function gave me this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/whatnott/public_html/order.php:6) in /home/whatnott/public_html/order.php on line 289
What does this mean?
Can anybody help me please?