I have the following input variable in my form:
<input class="caption_text" type="text" name="caption[]" required/>
That I create dynamically with JS.
After submitting I test the following:
$mycaption = \filter_input_array(\INPUT_POST, 'caption');
foreach ($mycaption as $eachInput) {
echo "Caption " . $eachInput . "<br>";
}
I discovered that the above code did not work.
However, typing $ _POST, like this:
$cpost = $_POST["caption"];
foreach ($cpost as $eachInput) {
echo "Caption " . $count. " - " . $eachInput . "<br>";
}
Then it works as expected.
Can anyone please tell me why the first approach does not work?