Code: Select all
<head>
<?php
if ( $_POST ){
$fail = false;
if ( filter_has_var( INPUT_POST, $_POST["fname"] ) ) {
$_POST["fname"]="";
$fail=true;
}
if ( filter_has_var(INPUT_POST, $_POST["lname"] ) ) {
$_POST["lname"]="";
$fail=true;
}
(MORE ERROR CHECKING CODE HERE...)
if ( filter_has_var(INPUT_POST,$_POST["zip"] ) ) {
$_POST["zip"]="";
$fail=true;
}
if ( filter_has_var(INPUT_POST, $_POST["cd"] ) ) {
$_POST["cd"]="";
$fail=true;
}
}
?>
</head>
<body>
<?php
if ( $_POST ){
if ( $fail == true ){
echo "<div id=\"error\" >";
}
if ( $_POST["fname"] == "" ){
echo "*Please enter your first name.<br />";
}
(MORE CODE HERE)
if ( $_POST["cd"] == "" ){
echo "*Please enter the number of CD's you are buying.<br />";
}
if ( $fail == true ){
echo "</div><hr />";
}
}
?>
</body>
Code: Select all
*Please enter your first name.<br />
*Please enter your last name.<br />
*Please enter your zip code.<br />
I am sending the form to itself right now because I can't think of a way to redirect the POST through pages without making a form (and the user submitting). If you'd like the full file, contact me, and let me know. I can email you the file.