Ok, like I said in icq.
A test page is at
http://www.madspiders.com/selecttest.php
The code I have for it (using mysql, not mysqli because I do not think I have mysqli on the server) is:
Code:
<?php
//error_reporting(0);
$dbhost="XXXXXXX";
$dbuser="XXXXXXX";
$dbpass="XXXXXXX";
$db = mysql_connect($dbhost, $dbuser, $dbpass);
$dbname="select_test";
$selected=mysql_select_db($dbname);
$query="select city_id, city_name from city order by city_name";
$city_result=mysql_query($query,$db);
if ($city_result)
{
$id = 1;
$query = "select model_id, city_id from model_in_city
WHERE model_id = $id
AND city_display = 1";
$modelresult=mysql_query($query, $db);
if ($modelresult)
{
echo "<select name=select multiple size=8>";
while ($cityrow = mysql_fetch_array($city_result))
{
echo "<option value=" . $cityrow['city_id'];
mysql_data_seek($modelresult,0);
while($model_city=mysql_fetch_array($modelresult))
{
if($model_city['city_id']==$cityrow['city_id'])
{
echo " selected ";
}
}
echo ">" . $cityrow['city_name'] . "</option>";
}
echo "</select>";
}
else
{
echo "no model result mysql error=" . mysql_error() . "<br>\n";
}
}
else
{
echo "no city result mysql error=" . mysql_error() . "<br>\n";
}
?>