forms .. selection boxes

Discussion in 'HTML & Website Design' started by crazyryan, Nov 11, 2006.

  1. #1
    I have this code:

    <select name="Package">
    <option>Package 1</option>
    <option>Package 2</option>
    <option>Package 3</option>
    <option>Package 4</option>
    <option>Package 5</option>
    <option>Package 6</option>
    <option>Custom Package</option>
    </select>
    HTML:
    I've seen on some sites they link to their contact page like .. contact.html?option=1 and like, package 1 will be automatically selected..

    Can anyone tell me how? thanks.
     
    crazyryan, Nov 11, 2006 IP
  2. rlineker

    rlineker Well-Known Member

    Messages:
    1,534
    Likes Received:
    172
    Best Answers:
    0
    Trophy Points:
    160
    #2
    I think you need to anchor each of the packages. I can't remember how but a search on google may help. Also you will probally find it is contact.php .

    Ryan
     
    rlineker, Nov 11, 2006 IP
  3. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #3
    I've had no luck so far, anyone know ?
     
    crazyryan, Nov 11, 2006 IP
  4. Munkyonline

    Munkyonline Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You have to make the page dynamic. I personally would use php.

    The links to the contact page would be :

    <a href="contact.php?package=1" title="Package 1">Package 1</a>
    <a href="contact.php?package=2" title="Package 2">Package 2</a>
    etc

    Then to make the select box select what they have chosen you would:

    <select name="Package">
    <option <?php if ($package==1) {echo ('selected="selected"');} ?>>Package 1</option>
    <option <?php if ($package==2) {echo ('selected="selected"');} ?>>Package 2</option>
    <option <?php if ($package==3) {echo ('selected="selected"');} ?>>Package 3</option>
    <option <?php if ($package==4) {echo ('selected="selected"');} ?>>Package 4</option>
    <option <?php if ($package==5) {echo ('selected="selected"');} ?>>Package 5</option>
    <option <?php if ($package==6) {echo ('selected="selected"');} ?>>Package 6</option>
    <option <?php if ($package==7) {echo ('selected="selected"');} ?>>Custom Package</option>
    </select>

    I've made an example here :

    www.munkyonline.co.uk/example

    Hope this helps =)
     
    Munkyonline, Nov 11, 2006 IP