tags:

views:

111

answers:

3

i have large form that i want to send in mail using php, although i can send it with request['name'] i have to write it more than 50 times in message variable, what i want to do how i can add the keys and values to message variable with some filteration that i want to omit submit request variable

A: 

http://php.net/filter_var_array might be what you're looking for.

VolkerK
A: 

Doesn't foreach do exactly that ?

foreach (filter_var_array($_REQUEST, ..) as $key => $value) {
    echo $key.' => '.$value."\n";
}

Of course don't forget to filter the data itself.

Lepidosteus
+1  A: 

I would make a copy of the variable, delete the submit element and then get the array declaration code with var_export:

$array = $_REQUEST;
unset($array['submit']);
$text = var_export($array, true);
Gumbo