I create my inputs using the following pattern:
<input type="text" name="general[fooBar]">
I wanted to do something like this in my PHP code:
$request = array(
'general' => filter_input(INPUT_POST, 'general')
);
echo $request['general']['fooBar'];
But filter_input
gives me false here. What's the best way to handle this?
The issue is in the FILTER_DEFAULT
,
filter_input(INPUT_POST, 'general', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);