Php drop down displays database

I am confused as to get my php drop down to work.

What I’m trying to do is make it so that when a selection is made from the drop down, the results displayed from the mysql query are refined for the selection. EX: At NewEgg if you click on computers it shows the full list of computers, but if you do the drop down for only hp’s then it refines the search. Here is my code so far:

<?php
    $category = array(
        '1' => 'California', 
        '2' => 'Texas');

    echo '<select name="category">';
    foreach ( $category as $key => $value ) {
        echo '<option value="' . $value . '">' . $value . '</option>';
    }
    echo  '</select>';

while ($result_row = mysql_fetch_row(($result))){
    echo 'State: '.$result_row[1]. '<br />';
    echo 'City: '.$result_row[2]. '<br />';
}

?>
<br>
<?php

//Login information
include('db_login.php');

//Connect
$connection = mysql_connect($db_host, $db_username, $db_password);
if (!$connection){
    die ("Could not connect to the database: <br />". mysql_error());
}
//Select the database
$db_select = mysql_select_db($db_database);
if (!$db_select)
{
    die("Could not select the database: <br />". mysql_error());
}

//Assign the query
$query = "SELECT * FROM properties";

//Execute query
$result = mysql_query( $query );
if (!$result){
    die ("Could not query the database: <br />". mysql_error());
}

$select = ' SELECT ';
$column = ' * ';
$from = ' FROM ';
$tables = ' properties ';
$query = $select.$column.$from.$tables;

//Fetch display results
while ($result_row = mysql_fetch_row(($result))){
    echo 'State: '.$result_row[1]. '<br />';
    echo 'City: '.$result_row[2]. '<br />';
}

//Close connection
mysql_close($connection);


?>