[thelist] Form Field Validation (mySQL / PHP)?

Warden, Matt mwarden at odyssey-design.com
Mon Jan 22 16:26:31 CST 2001


> The only thing I really need is to have some sort of a script that will
> force a user to enter something in at least one of the fields without
> having any of the fields required. Right now if one hits the submit
> button without entering any search criteria, the whole database
> displays.
> Here's the url
> http://www.albright.edu/dirsearch2.html

Something like this would do:

$goodInput = false;
if (IsSet($last_name)) $goodInput = true;
if (IsSet($first_name)) $goodInput = true;
if (IsSet($dept)) $goodInput = true;
if (IsSet($title)) $goodInput = true;
if (IsSet($phone)) $goodInput = true;
if (IsSet($email)) $goodInput = true;

Then, just do something if $goodInput is still false after the above code
segment.

I'm generally against accessing form values like this, but off-hand, I'm not
sure whether the following would always report as true or not:

if (IsSet($HTTP_POST_VARS['last_name'])) ...



--
mattwarden
mattwarden.com





More information about the thelist mailing list