SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question A Form Button With Two Posted Choices.

    This is my first posting, here at “sitepoint.com”. First let me apologies if I am repeating an asked and answered question. I went through a lot of the forums at “sitepoint.com” but was unable to find a question and/or answer relevant to mine . It is possible I might have missed one but here goes.

    I need to use a drop down menu in a form, so someone can make two different choices with only one choice. It needs to be able to post as "size" and "price" with the one choice.

    i.e.:
    <input type="hidden" name="size" value="">
    <input type="hidden" name="amount" value="">

    Size & Price: <select name="size">
    <option value="4x5">4"x5" - $2.00
    <option value="5x6">5"x6" - $4.00
    <option value="8x10">8"x10" - $6.00</select>


    I don't want to use radio buttons because it will take up too much room on the page. I searched the web and found a few Java Scripts but they did not work. Any help would be appreciated.

    Thank You

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,785
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Put both values in the value field with a comma in between. You can then split the value into an array and then do whatever you want with each value.

    See http://javascript.about.com/library/blmulti2.htm for an example.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Thank you for your prompt answer to . . .

    Thank you for your prompt answer to to my question. I read through the artical “One Form Field with Multiple Values”. I am fairly new to scripting. How do I rewrite his script to make it fit my needs?

    Thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •