Re: Re: Re: Re: How do I convert from perl to php?

From: Date: Tue, 20 Nov 2001 22:35:45 +0000
Subject: Re: Re: Re: Re: How do I convert from perl to php?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75312@lists.php.net to get a copy of this message
Or.. $required = array($name,$addr,$phone); foreach($required as $x) { if(!$x) { print "error"; } } ~Ryan ----- Original Message ----- From: "Philip Hallstrom" <philip@adhesivemedia.com> To: "Brandon Lamb" <php@digitaltension.com> Cc: "PHP List" <php-general@lists.php.net> Sent: Tuesday, November 20, 2001 2:37 PM Subject: [PHP] Re: Re: Re: How do I convert from perl to php? > No, but this: > > $required = array('name','address','phone'); > foreach( $required as $key ) { > if( empty($HTTP_POST_VARS[$key]) ) { > print("Sorry, you left key empty."); > } > } > > should work. > > > On Tue, 20 Nov 2001, Brandon Lamb wrote: > > > What about this? > > > > $required = array('name','address','phone'); > > while ( list($key, $value) = each ($required) ) { > > if ( empty($value) ) { > > print("Sorry, you left $key empty."); > > } > > } > > > > ----- Original Message ----- > > From: "Philip Hallstrom" <philip@adhesivemedia.com> > > Cc: <php-general@lists.php.net> > > Sent: Tuesday, November 20, 2001 2:22 PM > > Subject: Re: Re: How do I convert from perl to php? > > > > > > You could do something like this... there are lots of ways to validate > > your data... > > > > while( list($key, $value) = each($HTTP_POST_VARS) ) { > > if( empty($value) ) { > > print("Sorry, you left $key empty."); > > } > > } > > > > > > > > > > -- > > 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 > > > > > > -- > 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 (#75312) next »