Checking for empty fields

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

This is probly one of the simplier questions. What I need to do is check to make sure all of the fields are entered. I figured the best way for me to do this is to say "If the field is empty, $action eq 0, then the $action amount would determine the execution of the remaining script. Is their an %ENV variable that means null?

Also can I put multiple declarations in my if statement? (i.e.

if ($name eq "null, $address eq "null, ..etc
}

Can I do something like that?

Thanks for your help
VulKen

Pimpin like a pimp with an electrofied pimpin machine!

They have: 88 posts

Joined: Mar 1999

I have asked the same question and have
detailed the answer that I received:

The following code should check to make sure that all fields ($name, $email, $pass) were submitted:

code:

if($name eq "" | | $email eq "" | | $pass eq "") { #the | | means 'or'
print "not all required fields were filled in!";
exit; #this will stop the script from continuing and registration processes, ect
}
#put registration or whatever you want next here

Hope that helped. Smiling

Richard

[added]
Note: in perl, there is not a space between the two piplines |, the UBB adds this so
that it does not interfere with normal script operations (I guess?)
[/added]

------------------
[email protected]

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Thanx, that was quick...sure that was what I was looking for....forgot about that or thingy..hehe.

VulKen

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.