Posted by Peter Fox on 12/07/05 11:26
Following on from Carl's message. . .
>
>Easy, just treat $_POST as an array and use foreach.
>http://www.php.net/manual/en/control-structures.foreach.php
>
>Don't forget to make the post values safe before using them if they were
>input by the users...
>
Further don't forget that elements of $_POST may be arrays in their own
right. eg Checkboxes. Here is a snippet of code as illustration
#---------------------------------------------------------------------
function POSTget($VarName,$tidy=TRUE){
# read POSTed value from HTTP_POST_VARS
# Normally we'll tidy up the input to remove leading and trailing spaces
and control chars
# but this can be overridden.
#---------------------------------------------------------------------
if (isset($_POST[$VarName])){
$rv = $_POST[$VarName];
if(!is_array($rv)){
if ($tidy) {$rv = TidyInput($rv);}
}
}else{
$rv='';
}
return $rv;
}
--
PETER FOX Not the same since the porcelain business went down the pan
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
[Back to original message]
|