Re: Re: if elseif elseif elseif....

From: Date: Thu, 05 Mar 2009 10:42:26 +0000
Subject: Re: Re: if elseif elseif elseif....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-289354@lists.php.net to get a copy of this message
Davi Ramos wrote: > I tought you forgot to initializae the $obligatoryFieldNotPresent variable, > as PHP create variables when they are initialized, the > $obligatoryFieldNotPresent variable is created inside the if. > > $obligatoryFieldNotPresent = 0; > > 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"]) == "" ) { > $obligatoryFieldNotPresent = 1; > } > elseif (strlen($_POST["ISBNIN"]) == 0 ) { > $obligatoryFieldNotPresent = 1; > } > elseif (strlen($_POST["languageIN"]) == 0 ) { > $obligatoryFieldNotPresent = 1; > } > elseif (!empty($_POST['categoriesIN'])) { > $obligatoryFieldNotPresent = 0; > } > > It's there, I just didn't include it as it is followed by a lot of stringies: $obligatoryFieldNotPresent = 0; if (isset($_REQUEST["AddNewBooksRequest"])) { $titleIN = $_POST["titleIN"];.....snipetysnip... -- 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 (#289354) next »