Re: Error Checking

From: Date: Fri, 21 Jul 2000 17:50:21 +0000
Subject: Re: Error Checking
Groups: php.general 
Request: Send a blank email to php-general+get-7606@lists.php.net to get a copy of this message
>How would I check a bunch of variables for errors and display an error >message if they have errors or continue on into the script if they are >correct? >In psuedo code I want to do the following, but am unsure how to code it: >(note: not all the variables have the same validity checks, so I can't just >loop through them... for example one might be an e-mail address, and the >other a phone number) > >check var1 for validity >check var2 for validity >check var3 for validity >if errors, print messages else continue on (insert into table) > >thanks all. > >-Jeff > >-- unset($errors); if ($var1="badvalue1") $errors[]="Error message 1"; if ($var2="badvalue 2") $errors[]="Error message 2"; . . . if ($varn="bad value n") $errors[]="Error message n"; if (isset($errors)) { // display pages w/error messages and exit } // proceed w/insert Regards, Carroll Barrett

« previous php.general (#7606) next »