in reply to Insert into table when user clicks one of many submit buttons
You'll have to show us your form HTML to get more than a guess, but here's one: do your hidden fields have the same name attribute, like this?
<input type='hidden' name='cat_num' value='track1' /> ..... <input type='hidden' name='cat_num' value='track2' />
If that's the case, the browser may send the first value, or the last one, or do something random. I'm not sure the behavior is defined in the case of multiple input fields having the same name, but I am sure that's not going to work very well.
There are a couple of different ways to fix that, but first I'd look at what you're trying to do. Presumably you want to know which track(s) the user has selected. If you only want one track selected at a time, you can get rid of the hidden fields and give each submit button a different name, like "submit_track1", and parse that key to find out which one was clicked. If you want to allow multiple tracks to be checked, you'll need to put checkboxes next to them, or something that lets the user select a quantity. In that case, you would put the track name in the checkbox or other input field, and again would not need the hidden field. In fact, it's hard to see how hidden fields would help you here, since you need to use fields the user can interact with, to tell you which track(s) he wants.
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Insert into table when user clicks one of many submit buttons
by tinita (Parson) on Nov 28, 2011 at 11:59 UTC | |
by aaron_baugher (Curate) on Nov 28, 2011 at 14:09 UTC | |
|
Re^2: Insert into table when user clicks one of many submit buttons
by ironside (Acolyte) on Nov 28, 2011 at 03:44 UTC | |
|
Re^2: Insert into table when user clicks one of many submit buttons
by Anonymous Monk on Nov 28, 2011 at 09:20 UTC |