Now, I'm sending form
with several POST
, I get all of them and I add them to the DB. But I'm seeing a method using var_dump
, but I do not know how to deploy it in my code.
An example of how I do it today:
<?php
if ((!empty($action)) and ( $action == "envia")) {
// Recebe dados
$nome1 = filter_input(INPUT_POST, 'nome1', FILTER_DEFAULT);
$nome2 = filter_input(INPUT_POST, 'nome2', FILTER_DEFAULT);
// Adino no BD mysql
$mysqli->query("INSERT INTO nomes VALUES ('0', '$nome1')");
$mysqli->query("INSERT INTO nomes VALUES ('0', '$nome2')");
}
?>
<form name="form" method="post" action="index.php?action=envia">
<input type='text' name='nome1'>
<input type='text' name='nome2'>
<button type='submit'>Enviar</button>
</form>
Is there any way I can simplify this with var_dump
. This is a simple example, as I have a form with about 30 POST
.