Jump to content

Another one of those fun parse errors


mermyphp

Recommended Posts

You know how the world works... fix one thing break another.

 

I got my order form to list errors all on one page, and then realized that it gave me the following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/r/a/website/html/order/order.php:112) in /home/content/m/r/a/website/html/order/order.php on line 92

 

and here is my code:

<?php
/* Set e-mail recipient */
$myemail              = "[email protected]";

/* Check all form inputs using check_input function */
$subject              = check_input($_POST['subject'], "Please enter your name");
$email                = check_input($_POST['email'], "Please enter your email");
$phone                = check_input($_POST['phone']);
$street               = check_input($_POST['street'], "Please enter your street address");
$city                 = check_input($_POST['city'], "Please enter your city");
$state                = check_input($_POST['state'], "Please enter your state/province");
$country              = check_input($_POST['country'], "Please enter your country");
$postal               = check_input($_POST['postal'], "Please enter your zip code");
$Manufacturer         = check_input($_POST['Manufacturer'], "Please enter your boat manufacturer");
$Year                 = check_input($_POST['Year']);
$BoatClass            = check_input($_POST['BoatClass'], "Please choose your boat class");
$BoatModel            = check_input($_POST['BoatModel'], "Please choose your boat model");
$CoverModel           = check_input($_POST['CoverModel']);
$CoverQuantity        = check_input($_POST['CoverQuantity']);
$CoverBoatModel       = check_input($_POST['CoverBoatModel']);
$RigQuantity          = check_input($_POST['RigQuantity']);
$Fabric               = check_input($_POST['Fabric']);
$OarBag               = check_input($_POST['OarBag']);
$MainColor            = check_input($_POST['MainColorN']);
$TipColor             = check_input($_POST['TipColorN']);
$MainColor            = check_input($_POST['MainColorP']);
$TipColor             = check_input($_POST['TipColorP']);
$MainColor            = check_input($_POST['MainColorS']);
$TipColor             = check_input($_POST['TipColorS']);
$requests             = check_input($_POST['requests']);
$how                  = check_input($_POST['how']);

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
    show_error("E-mail address not valid");
}

/* Let's prepare the message for the e-mail */
$message = "example.com order form

From:
$subject
$email
$phone

Shipping Address:
$street
$city, $state
$country $postal

Boat Type
Manufacturer: $Manufacturer
Year Built: $Year
Boat Class: $BoatClass
Boat Model: $BoatModel

Quantity       Product

$CoverQuantity   of   $CoverModel

$RigQuantity   of   Rigger Bag

$OarQuantity   of   Oar Bag

Fabric
$Fabric

Colors- Make sure colors corrospond to fabric choice. Ignore any other colors.
Nylon Main Color: $MainColorN
Nylon Tip Color: $TipColorN

Polyester Main Color: $MainColorP
Polyester Tip Color: $TipColorP

Sunbrella Main Color: $MainColorS
Sunbrella Tip Color: $TipColorS

Special Requests
$requests

How They Found Us:
$how

";

/* Send the message using mail() function */
mail($myemail, $subject, $message, "From: $email");

/* LINE 92 is around here */
/* Redirect visitor to the thank you page LINE 92 */
header('Location: recieves.html');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
        show_error($problem);
    }
    return $data;
}

function show_error($myError)
{
?>
<p>
    <?php echo $myError; ?>
    <a href="javascript:history.go(-1)">Go back</a><br />
</p>
<?php
}
exit();
?>

 

I have a gut feeling this is just plain stupidity on my part, but if you could point out the mistake, I would be more than happy.

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/184913-another-one-of-those-fun-parse-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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