Re: checking $_POST variables

From: Date: Fri, 14 Mar 2003 19:35:12 +0000
Subject: Re: checking $_POST variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139757@lists.php.net to get a copy of this message
At 20:26 14.03.2003, drparker said: --------------------[snip]-------------------- >I'm running this script to make sure all fields are filled in on a form: > >foreach($_POST as $p) >{ > if(!$p) > { > header("Location: signup.php?error=3"); > exit(); > } >} > >But I need to exclude one field on the form from being checked - >Street2. How could I do this? --------------------[snip]-------------------- That's generally not a good idea because depending on the type of control empty input fields will not be available in the $_POST array (e.g. unchecked checkboxes are _not_ sent by the browser). You should rather have a list of input variables that need to be filled and compare $_POST against this. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#139757) next »