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.


In reply to Re: Insert into table when user clicks one of many submit buttons by aaron_baugher
in thread Insert into table when user clicks one of many submit buttons by ironside

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.