Updating Multiple Table Values w/ Post Data

12-11-08, 12:46 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2008
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Updating Multiple Table Values w/ Post Data
I'm trying to create sort of a CP for myself where I can update multiple table values through POST data. Basically I have a table on the page that displays all the information pulled from the table I'm editing, and each field is within an form input text box. Looks like this:
This is just a snippet of code to show you how it's set up. So, I send this data to another file, which contains:
This would work fine if there was only 1 form I was working with, but with the way I have it set up I have 1 form with multiple same-named values, if that makes any sense. Anyway, how can I change my code so I can mass update what data is displayed on the table? While retaining values that weren't changed, of course.
Thanks a bunch!
|

12-11-08, 02:25 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
use form arrays by naming your form inputs with [] on the end and then this will populate the $_POST results as an array;
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|

12-11-08, 02:27 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2008
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ah, thanks a bunch! Do I need to change anything within the mysql query? Or will it be able to pick and choose the way it is?
|

12-11-08, 02:34 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think you would just need to experiment with the values, PHP does some neat tricks when working with this kind of thing as far as I've experienced but I would always check to see what values are coming through from what scenarios.
It's easy to check;
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|

12-11-08, 02:39 PM
|
|
Newbie Coder
|
|
Join Date: Nov 2008
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks again DAL, this is going to help a lot.
|

12-11-08, 02:58 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
no problem - best of luck
Cheers
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|