i have a form like this
<form action="insert_controllo.php" method="POST">
<table>
<th>Macchina</th>
<th>Dispositivo</th>
<th>Descrizione</th>
<th>OK</th>
<th>NOK</th>
<th>PARZ</th>
<th>NA</th>
<th>Note</th>
<?while($row = mysql_fetch_array($risultato)){
echo '<tr><td> <input class="hide" type= "text" name="elements['.$count.'][macc]" value ="'.$row["macc"].'" readonly>
</td><td> <input class="hide" type= "text" name="elements['.$count.'][iddispsic]" value ="'.$row["iddispsic"].'" readonly>
</td><td> <input class="hide" type= "text" name="elements['.$count.'][descgen]" value ="'.$row["descgen"].'" readonly>
</td><td> <input type= "radio" name="elements['.$count.'][chk1][]" value ="OK" checked>
</td><td> <input type= "radio" name="elements['.$count.'][chk1][]" value ="NOK">
</td><td> <input type= "radio" name="elements['.$count.'][chk1][]" value ="PARZ">
</td><td> <input type= "radio" name="elements['.$count.'][chk1][]" value ="NA">
</td><td> <input type="text" name="elements['.$count.'][note]" placeholder = "Note">
</td></tr>';
$count ++;
}?>
</table>
<button class="bottone" name='submit' type='submit'>Concludi</button>
in the page "insert_controllo.php" if i print_r($_POST);
i can see all the variable in the right way
<!-- POST: Array
(
[elements] => Array
(
[0] => Array
(
[macc] => 09
)
[1] => Array
(
[iddispsic] => 8
[macc] => 09
[descgen] => Comandi di emergenza
[chk1] => Array
(
[0] => OK
)
[note] =>
)......
i'm trying to retrieve the variable like this
for($i=0; $i<count($_POST['elements']); $i++){
$macc = $_POST['elements']['macc'];
$dispsic = $_POST['elements']['iddispsic'];
$descgen = $_POST['elements']['descgen'];
$chk1 = $_POST['elements']['chk1'];
$note = $_POST['elements']['note'];
echo $macc;
echo $dispsic;
echo $descgen;
echo $chk1;
echo $note;
var_dump($macc);
}
}
but in the var_Dump i get only NULL value. i need to INSERT them in my DB table can someone help me? thanks a lot best regards