CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to return a result from a drop down listbox in HTMl?

  1. #1
    Join Date
    Jul 2005
    Posts
    43

    How to return a result from a drop down listbox in HTMl?

    Hello.

    Creating the box is easy enough.

    <select><option> etc. etc. etc.

    If you create the list box in a form, how do you return a result when someone clicks submit.

    I'm already using PHP to read the listbox data out of mysql, but that won't be useful, because it runs on the server side, and by the time the user clicks the box and hits submit, the server has already calculated.

    I'd prefer not to use Java or client side scripts but will if absolutely necessary.

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: How to return a result from a drop down listbox in HTMl?

    Depends on whether you are using get or post as your method. Below is an example of post.

    PHP Code:
    <?php
    $select 
    $_POST['select_tag_name'];
    ?>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Aug 2002
    Posts
    879

    Re: How to return a result from a drop down listbox in HTMl?

    there is no difference in submitting a Edit/Input field or a Drop-Down-List selection

    form.html
    PHP Code:
    ..............
    <
    form action="submit.php" method="post">
    <
    select name="dropdown">
    <
    option value="test1">test 1</option>
    <
    option value="test2">test 2</option>
    <
    option value="test3">test 3</option>
    </
    select>
    <
    input type="submit" />
    </
    form>
    ............. 
    submit.php
    PHP Code:
    ..........
    You selected <?php echo $_POST["dropdown"]; ?>.<br />
    ..........

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)