PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
To simplify, I have stripped my code example down to the essential issue. I have a form that is populated with a list of records from a database. An example would be a list of products and their assiciated prices. There is a auto_increment primary key. With all the product items on one screen, I want to change prices of some, then reupload the whole lot back to the database. I can populate my form just fine, but I can't get the edited data back into the database. I've tried to set up a foreach loop, but no changes were reflected. Any help appreciated.
I have made a small change to how your form is submitted on lines 13 and 15. Instead of using a hidden field, why not use the name of the submit button itself for the submit action? Maybe your stuff is not being submitted at all?
<!--Notice the square brackets after name="id[]" - this defines this element as an array, when it is submitted.-->
<input name="id[]" type="text" value="<?php echo ($row["id"])?>
"/>
When you've done this to all of you form elements, you'll then need to use a for loop to process the data when the form has been submitted.
Thanks, I see how you have modified the way the fields are populated. How to structure the for or foreach loop to send the data to the database has me stumped.