Hi. I'm working on this very simple online ordering system for the company I work for where customer can place an order, review it, and finally submit it. I and using sessions to pass variables between pages and the final goal is to send me an e-mail with whatever the customer ordered. For now, all I am e-mail myself is my name, but for a reason which I don't know, I get multiple e-mails. Sometimes 2, sometimes 5. What could be causing that? Here's the code:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Review your order</title>
<link rel="stylesheet" type="text/css" href="review.css" />
<link rel="shortcut icon" href="" type="image/x-icon">
</head>
<body>
<form method="post" action="confirmation1.php">
<p>Please, review your order.</p>
<table>
<?php
$_SESSION['order'] = "carlos";
$counter = 0;
print "<tr><td><code>Customer</code></td><td>$_POST[Customer]</td></tr>\n";
print "<tr><td><code>E-mail</code></td><td>$_POST[Email]</td></tr>\n";
print "<tr><td><code>Phone</code></td><td>$_POST[Phone]</td></tr>\n";
print "<tr><td><code>P.O.#</code></td><td>$_POST[PO]</td></tr>\n";
print "<tr><td><code>Line</code></td><td>$_POST[Line]</td></tr>\n";
if (isset($_POST[Assembly])) {
print "<tr><td><code>Assembly</code></td><td>Yes</td></tr>\n";
$counter--;
}
else
print "<tr><td><code>Assembly</code></td><td>No</td></tr>\n";
if (isset($_POST[Delivery])) {
print "<tr><td><code>Delivery</code></td><td>Yes</td></tr>\n";
$counter--;
}
else
print "<tr><td><code>Delivery</code></td><td>No</td></tr>\n";
print "<tr><td><code>Notes</code></td><td>$_POST[Notes]</td></tr>\n";
foreach ($_POST as $key => $value) {
if ($counter <= 5) {
$counter++;
continue;
}
if (strlen($value) > 0)
print "<tr><td><code>$key</code></td><td>$value</td></tr>\n";
}
?>
</table>
<p id="buttons">
<input type="submit" value="Confirm" />
</p>
</body>
</html>
<?php
session_start();
?>
<?php
$to = "neatrading@yahoo.com";
$subject = "New Order";
mail($to, $subject, $_SESSION['order']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Order confirmation</title>
<link rel="stylesheet" type="text/css" href="review.css" />
<link rel="shortcut icon" href="" type="image/x-icon">
</head>
<body>
<p>Thank you for your order. You will receive a confirmation shortly.</p>
<p>Please, check your e-mail for more details.</p>
</body>
</html>
The first page is where the form is and it also starts with
<?php session_start(); ?>
Thanks.