Re: IF ELSEIF ELSE??

From: Date: Fri, 03 Aug 2001 22:44:09 +0000
Subject: Re: IF ELSEIF ELSE??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61182@lists.php.net to get a copy of this message
"Gerard Samuel" <trini0@optonline.net> wrote in message news:3B6B1CF3.8070809@optonline.net... > 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."; } My guess is that you forgot the last two brackets? '{' and '}' But I am not sure they are required, I guess they are when you begin with one, so that one must end the if.

« previous php.general (#61182) next »