Selected Dropdown

Discussion in 'Programming' started by Anupma Maggu, Feb 3, 2012.

  1. #1
    Hi,
    How can we post selected option "name" and "value" both in php?
    plz help frnds.
     
    Anupma Maggu, Feb 3, 2012 IP
  2. MarPlo

    MarPlo Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    48
    #2
    Hi,
    From what i know, the browser sends only one pair data; the name of selected dropdown list with the value of selected option.
     
    MarPlo, Feb 7, 2012 IP
  3. flight05

    flight05 Active Member

    Messages:
    122
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #3
    example:

    The name goes under SELECT
    The value is dependent on which one they choose.
     
    flight05, Feb 8, 2012 IP
  4. malinda

    malinda Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <select name="nameOne" id="nameOne">
    <option value="whatever">WHATEVER U WANT THEM TO SEE</option>
    <option value="whatever1">WHATEVER U WANT THEM TO SEE</option>
    </select>

    ----php code---


    $name = $_POST['nameOne'];

    echo $name // print the value of 'select' this ex. whatever or whatever1
     
    malinda, Feb 10, 2012 IP
  5. victa

    victa Peon

    Messages:
    400
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yep pass them using $_POST var
     
    victa, Feb 11, 2012 IP