Specifications
//empty shopping cart
session_destroy();
echo “Thankyou for shopping with us. Your order has been placed.”;
display_button(“index.php”, “continue-shopping”, “Continue Shopping”);
}
else
{
echo “Could not process your card, please contact the card issuer or try
➥again.”;
display_button(“purchase.php”, “back”, “Back”);
}
}
else
{
echo “You did not fill in all the fields, please try again.<hr>”;
echo “<form action = ‘purchase.php’ method = post>”;
echo “<input type = hidden name = from value = process>\n”;
// pass the data this page received back so the user won’t have to re-enter
foreach($HTTP_POST_VARS as $name => $value)
echo “<input type = hidden name = $name value = ‘$value’>\n”;
display_form_button(“back”, “Back”);
echo “</form>”;
}
do_html_footer();
?>
The crux of this script is these lines:
if(process_card($HTTP_POST_VARS))
{
//empty shopping cart
session_destroy();
echo “Thankyou for shopping with us. Your order has been placed.”;
display_button(“index.php”, “continue-shopping”, “Continue Shopping”);
}
Building Practical PHP and MySQL Projects
P
ART V
574
LISTING 25.16 Continued
31 7842 CH25 3/6/01 3:39 PM Page 574










