i have multiple input-fields with the same name as id's and the other fields with other names like
<input name="id[]" value="1" /> <input name="st[]" value="4" />
<input name="id[]" value="5" /> <input name="st[]" value="57" />
<input name="id[]" value="79" /> <input name="st[]" value="43" />
.
.
.
in my sql table i want to change ...maybe id->3 and id->87 or whatever 10 others to update the column "st" with the value from the right side input field. The key values from id and st are the same. I know the update-sql-syntax of one row. but, if i want more rows i dont know what to do
my reasoning was do it with Jquery Ajax or php Implode like
$id = implode(',', $_POST['id']);
$st = implode(',', $_POST['st']);
$sql = "UPDATE table SET st=('$st') WHERE id=('$id')";
then i found this from user peterm
UPDATE table
SET st = CASE id
WHEN 'id_x' THEN 'st_x'
WHEN 'id_y' THEN 'st_y'
...
ELSE st
END
WHERE id IN('id_x', 'id_y', ...);
How do i get it with spontaneously entrys from my website-user in a loop (foreach?)