how to capture a listbox selected value in to variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • student1
    New Member
    • Nov 2006
    • 3

    how to capture a listbox selected value in to variable

    how to capture a listbox selected value in to variable.im able to capture radibox value and check box value but for dropdownbox im not able to capture.plz help me
  • billkirim
    New Member
    • Nov 2006
    • 25

    #2
    <select name="x" size="1">
    <option value="1">bill</option>
    <option value="2">kirim</option>
    </select>

    when you will submit this form ... if you choose bill then
    $x=1
    if you choose kirim then
    $x=2

    Comment

    • brainpulse
      New Member
      • Nov 2006
      • 1

      #3
      is there any possiblity to get the value and the name of the specific selection ?

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        You can pick up the value via the $_GET or _POST (depending on the method to submit your form), When it is a single SELECT, as follows

        [php]$value = $_POST['x'];[/php]

        Ronald :cool:

        Comment

        Working...