![]() |
Save inputs (text, textarea) into database, with same names?
This is my first PHP script, so please bear with me! :)
I have a table, with each row representing a row from a database table. Each of the fields in the table are editable, so when the user edits a couple of them and hits 'Save', the appropriate ones need to be saved. As you can see from this pastebin snippet, users can create new rows and save them. http://wordpress.pastebin.com/d1fd7e116 I need to be able to save the appropriate items into the database; I have commented in where the problem lies! At the moment, it's just saving the last outputted row. |
Where are the comments ?
I think in line 14 the id could be AUTO_INCREMENT and unique/primary. |
Sorry, I've updated the pastebin: http://wordpress.pastebin.com/m4e5721ac
My problem is with updating the existing rows which are outputted using the 'foreach' on line 25 onwards. |
Line 10: $field2 = $_POST[row_field2'];
You forgot to put row_field2 between ''. You only put 1 ' in the end. $field2 = $_POST['row_field2']; Edit: 1000 posts!! :-D :-D |
I've fixed the typo, but its not really the problem :P
|
Not sure but try changing:
PHP Code:
PHP Code:
|
| All times are GMT. The time now is 03:59 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0