if elseif elseif elseif....

From: Date: Wed, 04 Mar 2009 22:51:11 +0000
Subject: if elseif elseif elseif....
Groups: php.general 
Request: Send a blank email to php-general+get-289294@lists.php.net to get a copy of this message
This is probably a mysql question, but their list is rather dull - I think they don't appreciate my humor. Beside this list is fun ... and informative. Anyway, I can't figure this out. I am trying to verify inputs on a form and even if I have all the required fields right, I still get the error that there are empty obligatory fields. This is what I am using... but I'm open to anything that works or is more efficient: if (strlen($_POST["titleIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["first_nameIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["publisherIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["copyrightIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["ISBNIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["languageIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif (strlen($_POST["categoriesIN"]) == 0 ) { $obligatoryFieldNotPresent = 1; } elseif ($obligatoryFieldNotPresent = 1) { $obligatoryFieldNotPresent = 0; } I've tried closing with else ($obligatoryFiieldNot Present = 0); end; but that give me a blank page - haven't figure out how to check for parsing or scripting errors Thanks for any suggestions. -- unheralded genius: "A clean desk is the sign of a dull mind. " ------------------------------------------------------------- Phil Jourdan --- pj@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php

« previous php.general (#289294) next »