PHP List Menu

Discussion in 'PHP' started by jcnkty, Jul 28, 2007.

  1. #1
    this is the php script of the form script of list menu



    <?
    include "./connect.php";
    echo "<label>";
    ?>
    <select name="origin_city" size="10" multiple="multiple" id="origin_city">
    <?
    $connect = mysql_pconnect($dbhost,$dbusername,$dbuserpassword);
    $query = "SELECT * from cities where StateID='$service'";
    $result = mysql_db_query($dbname,$query);
    while($row = mysql_fetch_array($result))
    {
    echo "<option value = ". $row["CityID"] . ">" . $row["city"] . "</option>";
    }
    echo "</select>";
    echo "</label>";
    ?>


    ----------------------------------

    Question :
    How do i get the data if the user select multiple.

    I want the display like this for example 1,4,8,9
     
    jcnkty, Jul 28, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    <select name="origin_city[]" ...
    Code (markup):
    $_POST['origin_city'] will be an array of the values of selected items.
     
    krt, Jul 28, 2007 IP