Re: variable ?

From: Date: Mon, 18 Dec 2000 14:09:54 +0000
Subject: Re: variable ?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-30920@lists.php.net to get a copy of this message
Well, he wanted to check if a field was set. Using isset($varname) will not work, because even if a form/field is not filled out, the variable is still set and passed along, its just set to nothing ( "" ). So do a if($var!=""){ print "This Variable Has Been Set!"; } else { print "This Variable Was Not Set!"; } ----- Original Message ----- From: Teodor Cimpoesu <teo@digiro.net> To: <php-general@lists.php.net> Sent: Monday, December 18, 2000 8:57 PM Subject: Re: [PHP] variable ? > Hi Mike! > On Mon, 18 Dec 2000, Mike wrote: > > > I have a form that passes 4 of a possible 8 variables to a script.How can I > > tell which 4 were passed? > > Mike P > > mpeloso@princeton.edu > here's my favourite: user arrays, namely instead of <input name="var1" ...> > use <input name="vars[foo]" ...> so on, then you simply say : > $stuff = $vars['foo']; > or the careful programmer with E_ALL and all, would write something along: > isset($vars['foo']) && ($stuff = $vars['foo']); > > cheers, > > -- teodor > > -- > 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 > >

« previous php.general (#30920) next »