I have the following form in which i need to updateitems.
The problem is that i do not know how many elements will be in the form
(generated dynamically)
eg
<input type = "hidden" name ="id1" value="1"><inpu t type ="qty1" value ="1">
<input type = "hidden" name ="id2" value="2"><inpu t type ="qty2" value ="1">
<input type = "hidden" name ="id3" value="3"><inpu t type ="qty3" value ="5">
<input type = "hidden" name ="idn" value="n"><inpu t type ="qtyn" value ="1">
how do i generate an array for a foreach loop to update the values in PHP
so that i can use it to create a Update query
eg
///begin loop
$sql = "UPDATE `table` SET `qty` = `$qtyn` WHERE `id` = `$idn`";
// end loop
many thanks for any help
Craig
The problem is that i do not know how many elements will be in the form
(generated dynamically)
eg
<input type = "hidden" name ="id1" value="1"><inpu t type ="qty1" value ="1">
<input type = "hidden" name ="id2" value="2"><inpu t type ="qty2" value ="1">
<input type = "hidden" name ="id3" value="3"><inpu t type ="qty3" value ="5">
<input type = "hidden" name ="idn" value="n"><inpu t type ="qtyn" value ="1">
how do i generate an array for a foreach loop to update the values in PHP
so that i can use it to create a Update query
eg
///begin loop
$sql = "UPDATE `table` SET `qty` = `$qtyn` WHERE `id` = `$idn`";
// end loop
many thanks for any help
Craig
Comment