# Drop down list (php) from sql db

**URL:** <https://forum.kirupa.com/t/drop-down-list-php-from-sql-db/203591>\
**Category:** Uncategorized\
**Created:** [October 12, 2006, 10:03am UTC](https://forum.kirupa.com/t/drop-down-list-php-from-sql-db/203591 "2006-10-12T10:03:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pucca](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@pucca](https://forum.kirupa.com/u/pucca)\
**Post date:** [October 12, 2006, 10:03am UTC](https://forum.kirupa.com/t/drop-down-list-php-from-sql-db/203591/1 "2006-10-12T10:03:35Z")

</div>

hi there

I’ve got a dropdown list where I get the values from a mysql db.

Here’s my code for creating a rs which works fine…:

```php
$sql = "Select * FROM desta_provinces where CountryId = 1 and Id != 9 and Id != 90 and Id != 98 ORDER BY Name asc";
$rsprovinces = mysql_query($sql,$conn);
$rows = mysql_fetch_assoc($rsprovinces);

```

In my list, everything displays correctly, but when I select one value, and click on the button of the form, It doesn’t take my Id with. Heres my code:

```auto
    <form action="provinces.php?Id=<?php echo $rows['Id'];?>" method="post">
                  <?PHP
                                if( mysql_num_rows($rsprovinces)>0 ) {
                                    echo '<select name="provlist">';
                                    while ( $rows = mysql_fetch_array ($rsprovinces) ) {
                                        echo '<option>' . $rows['Name'] . '</option>';
                                    }
                                    echo '</select>';
                                }  
                    ?>    
                        
                    <input name="btn" type="submit" value="go" />

            </form>    

```

Everything seems fine to me? can somebody please help me?

thanks!
