Results 1 to 2 of 2

Thread: i want values of selected item frokm listbox

  1. #1

    Thread Starter
    Registered User
    Join Date
    Oct 2001
    Location
    mysore
    Posts
    60

    i want values of selected item frokm listbox

    urgent please hurry up(simple question)i wnat values of item selected in listbox(<select name=yahoo type=list multiple>) after submnitting form
    if i use count($yahoo) or sizeof($yahoo) if giving incorrect values
    why it is happening.

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Here's an example:

    Code:
    <?php
    
        if (isset($_POST['submit'])) {
            for ($i = 0; $i < count($_POST['yahoo']); $i++) {
                echo $_POST['yahoo'][$i] . "<br>\n";
            }
        } else {
            echo '<form action="test.php" method="post">
                <select name="yahoo[]" type="list" multiple>
                    <option value="one">One</option>
                    <option value="two">Two</option>
                    <option value="three">Three</option>
                </select><br>
                <input type="submit" name="submit" value=" Submit ">
            </form>';
        }
    
    ?>
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width