if (!$HTTP_POST_VARS) exit();
else {
  if (!$Age)   { echo "Please enter your age.<br>\n"; }
  if (!$Email) { echo "Please enter your email.<br>\n"; }
  if (!$State) { echo "Please enter your Location.<br>\n";}
  if ($Age && $Email && $State) echo "Thanks for your submission.";
}

Your if and else statements used every possibility up, so that last else
will never get hit.  There are a lot of things you can do better with the
above code, but it'll do what you want.  For example something you might
want to look at the type of data the person is entering, a little
validation.  I hope that helps.

Rick

> Whats wrong with this piece of code.  Basically, it not doing the last
> else statement.
> 1.  If no form was submitted exit.
> 2.  If a form was submitted, check for 'empty' strings.
> 3.  If all is good, echo "xxxxx";
> 
> Thanks all.
> 
> 
> 
> if (!$HTTP_POST_VARS) { exit(); }
> elseif ($HTTP_POST_VARS) {
> if (!$Age) { echo "Please enter your age.<br>\n"; }
if 
> (!$Email) { echo "Please enter your email.<br>\n"; }
> if (!$State) { echo "Please enter your Location.<br>\n";}
> }
> else
> echo "Thanks for your submission.";


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to