I have a table with rows, which is in the form: ID, Name, Name, IntA, IntB, IntC, ... The last columns are text fields.
I want to select a few lines with a checkbox and send the identifier and the written integers with POST to another PHP file.
This is my sample code (it is a bit German in it):
echo "<td><input type='checkbox' name='auswahl[]' value='$daten[0]'></td>";
echo "<td>" . $daten['ID'] . "</td>";
echo "<td><input type='number' name='Schr' value='".$punkte['PktSchr']."'></td>";
echo "<td><input type='number' name='Mdl' value='".$punkte['PktMdl']."'></td>";
So, in another PHP file, I want SQL for all marked lines like this (in Loop):
$Eintraege = $_POST['auswahl'];
$Schr = $_POST['Schr'];
$Mdl = $_POST['Mdl'];
foreach ($Eintraege as $i){
$sql = "INSERT INTO aufnahme (IDSchueler, PktSchr, PktMdl) Values ('$i', '$Schr', '$Mdl')";
}
My problem is this: it $Eintraege
contains only the identifiers of the selected rows (due to value='$daten[0]'
).
$Schr
and $Mdl
contains the values of the text fields of the last line (it does not matter which lines are selected).
So, I tried to set value='$daten'
and use its lika for the array, but then I get an exception.
, value='$daten[0]'
, , .
!