Reputation: 20282
I tried to use filter_input
to load my POST value into a variable:
$tmp = filter_input(INPUT_POST, "p_member"); // fails
Output:
bool(false)
I also tried $tmp = filter_input_array(INPUT_POST, "p_member"); // fails
Output:
bool(false)
But this works:
$tmp = (array)@$_POST['p_member'];
Output:
Upvotes: 2
Views: 317
Reputation: 1876
here is an answer based on link
If your $_POST contains an array value:
$_POST = array( 'var' => array('more', 'than', 'one', 'values') );
you should use FILTER_DEFAULT AND FILTER_REQUIRE_ARRAY option:
var_dump(filter_input(INPUT_POST, 'var', FILTER_DEFAULT , FILTER_REQUIRE_ARRAY));
Otherwise it returns false.
Upvotes: 2