Now this looks like what I would want...

brandon

----- Original Message -----
From: "Philip Hallstrom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 20, 2001 2:22 PM
Subject: [PHP] 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.");
}
}

This is assuming the form method is POST.  If it's GET, switch POST with
GET above.

-philip

On Tue, 20 Nov 2001 [EMAIL PROTECTED] wrote:

> 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to