SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Dark_angel's Avatar
    Join Date
    May 2003
    Location
    Canada
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select tag question...

    When you use the select statement you can only assign one value to be passed on to another page using FORM method, thats how i know it anyway i was wondering if there is more than one value you can pass using select.
    To be more elaborate
    eg.

    <FORM METHOD=POST ACTION='quote.php'>
    Motherboard
    <SELECT NAME='listbox1'>
    <OPTION VALUE='234'>AMD1 $234</OPTION>
    <OPTION VALUE='324'>AMD2 $324</OPTION>
    <OPTION>P3 $123</OPTION>
    </SELECT>

    in "quote.php" there will be
    $motherboard =$_POST[listbox1];
    echo "$motherboard";

    now assuming the first option is choosen, this only gives the value '234', also wanted the AMD1 to come separatly. is there any way to do this..

    Thanks In advanced
    Dark_Angel
    "A person Who asks a Question might be fool for a day,
    But a person who doesnt is a fool forever..."

  2. #2
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No easy way that doesn't rely on client side scripting.

    Instead, just build an array in PHP (which is what I assume you are using based on the above) with the key '234' and the value 'AMD1'. Then you just refer to it as:
    $motherboard_types[$_POST["listbox1"]]
    Love it? Hate it? Helpful? Useless?
    Use the rate button to let me know what you think of my post!


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
  •