so to do what you want would be
PHP Code:
foreach ($HTTP_POST_VARS AS $pram=>$value){
define ($value . "_error", "Error Text");
}
Will treat the values as strings and say you had a variable named $name, your error version should be name_error without the $
Ben
so...
if (empty($_POST['fields'])) {
$fields = $_POST['fields'];
for($i=0;$i<count($fields);i++){
define ($fields[$i] . "_error", "Error Text");
};
//All done
};
to test the values....(you can also use the for next here as well
if ( defined('something_error') && something_error ) print(something_error);
you may also use a case insensative feature by inserting
, TRUE);
at the end of
define ($fields[$i] . "_error", "Error Text", TRUE);