I have a form that contains the following fields:
...
<input type="checkbox" name="Cadastro[]" value="S"> Sim
<input type="checkbox" name="Cadastro[]" value="N"> Não
....
I'm retrieving field values using filter_input (). For example:
$nomeUsuario = filter_input(INPUT_POST,"NomeUsuario",FILTER_DEFAULT);
In the case of the fields Record and Edit, how are array, how would I get the values like the filter_input and play into a function?
function executar($cadastro){
....
}
I'm using it that way, but I'm not getting it:
$cadastro = filter_input_array(INPUT_POST,"Cadastro");
When giving var_dump($cadastro);
, it returns:
bool (false)
And when I use $_POST["Cadastro"];
, it returns only the first value:
$cadastro = $_POST["Cadastro"];
function testar($cadastro){
foreach($cadastro as $teste){
$valor = $teste."<br>";
}
return $valor;
}
}
echo testar($cadastro); // Retorno S