I am pretty noobish at PHP. This is supposed to check whether or not a submitted address has all the fields filled in. If it does, it is supposed to echo which fields need filling in, and if it doesn't it's supposed to redirect to another page. This is what I got, but it doesn't work:
<HTML>
<BODY>
<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$streetaddress = $_POST['streetaddress'];
$streetaddress2 = $_POST['streetaddress2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$otherinfo = $_POST['otherinfo'];
if ($firstname == "" or $lastname == "" or $streetaddress == "" or $city == "" or $zipcode == "")
echo "<font color='red'>You forgot to fill out some fields. Click the back button to fix the mistake.";
elseif ($firstname == "")
echo "You must fill in the First Name.<br />";
elseif ($lastname == "")
echo "You must fill in the Last Name.<br />";
elseif ($streetaddress == "")
echo "You must fill in the Street Address.<br />";
elseif ($city == "")
echo "You must fill in the City.<br />";
elseif ($zipcode == "")
echo "You must fill in the Zip Code.";
else
header( 'Location: http://www.google.com' ) ;
endif;
?>
</BODY>
</HTML>
Can anyone assist? Why doesn't this work? Thanks.