Mo.
Mo.

Reputation: 27503

two select at a time in combo box - how to solve it?

Here I'm using combo box for searching working fine fetch from MySQL.

here is the code

<select name="location" class="styled">
    <option selected="selected" value=''>Any</option>
    <?php
    while ($loc_row = mysql_fetch_array($loc_result))
    {
     echo "<option value='$loc_row[job_location]'";
     if($loc_row['job_location'] == $location)
      {
        echo 'selected="selected"'; 
      }
      echo ">$loc_row[job_location] </option>";
    }
    ?>
    </select>

when click on search get string becoming as selected $location=isset($_GET['location'])?$_GET['location']:''; during this time there are two selected value.

could any one can help me to be one select value please

Upvotes: 1

Views: 537

Answers (1)

user149341
user149341

Reputation:

Remove the selected="selected" from the default "Any" option. The first element is selected by default.

Upvotes: 2

Related Questions