RE: [PHP] IF statement problems
| From: | Sam Masiello | Date: | Mon, 31 Jul 2000 18:42:19 +0000 |
| Subject: | RE: [PHP] IF statement problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9229@lists.php.net to get a copy of this message | ||
You are missing a semicolon after $value=4
HTH
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: Paul Hawkins [mailto:phawkins@californiasteel.com]
Sent: Monday, July 31, 2000 2:37 PM
To: php-general@lists.php.net
Subject: [PHP] IF statement problems
I'm having a bit of trouble with an if statement generated from a few
pull-down menus on a form. The two pull-downs set the variables $vname and
$div. Based on the combination of their values I need to set a separate
variable $value. The following IF statement works fine until I include the
last if statement. IF the last IF statement is in the script it gets
evaluated as true no matter what is selected on the form.
Here is the code:
if ($choice) {
if (($vname==1) AND ($div==1)) {
$value=1;
}
if (($vname==1) AND ($div!=1)) {
$value=2;
}
if (($vname!=1) AND ($div==1)) {
$value=3;
}
if (($vname!=1) AND ($div!=2)) { //bad if statement
$value=4
}
}
Thanks,
Paul Hawkins
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net