Re: Re: [PHP] How do I convert from perl to php?

From: Date: Tue, 20 Nov 2001 22:38:21 +0000
Subject: Re: Re: [PHP] How do I convert from perl to php?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-75309@lists.php.net to get a copy of this message
How about like this: $required = array("field1","field2","field3"); for ($i=0;$i<count($required);$i++) { $temp = $required[$i]; if (trim($$temp) == "") { echo "You Missed One"; continue; (break?) } } Something like that, I havn't acually tried it. ----- Original Message ----- From: <digital1@olypen.com> To: <php-general@lists.php.net> Sent: Tuesday, November 20, 2001 2:21 PM Subject: Re: Re: [PHP] How do I convert from perl to php? > So I would have to write a seperate if condition for each form input field i wanted to require? that doesn't make for a very dynamic script... > > > if(!(isset($name) && isset($address) && isset($phone)) { > > echo "You left one empty."; > > } > > > > On Tue, 20 Nov 2001 digital1@olypen.com wrote: > > > > > I am a perl user trying to convert to php > > > > > > how would i turn this perl into php? > > > > > > use CGI; > > > > > > $name = param(name); > > > $address = param(address); > > > $phone = param(phone); > > > > > > @required = qw( name address phone ); > > > > > > foreach $key($required) > > > { > > > if (!$$key) { &out("You left one 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

« previous php.general (#75309) next »