note 17429 deleted from control-structures.while by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 22:24:34 +0000 |
| Subject: | note 17429 deleted from control-structures.while by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23488@lists.php.net to get a copy of this message | ||
to itenerate through your a html form's results, i've found the following to work well.
note it also check for arrays in a key, e.g. a bunch of <INPUT type='text'
name='favorite_colors[]'>
if ($HTTP_POST_VARS)
{
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS))
{
if (is_array($val))
{
for ($i=0; $i < count($val); $i++){
$val[$i] = trim($val[$i]);
$val[$i] = addslashes($val[$i]);
//$GLOBALS[$key] = $val[$i];
}
}
else
{
$val = trim($val);
$val = addslashes($val);
//$GLOBALS[$key] = $val;
}
}
}