Well, first you probably want your dropdown to reflect the city id when you are pulling in your vars.
Like this:
Code:
echo "<option value=" . $city_id . ">$name</option>";
Now, I am not sure what you are trying to do but you said " incorporate the selected value into the form:". Which selected value? The city that was already selected somewhere? You are losing me there, maybe just too late in the night for me..lol.
If you have a selected city coming in then what you would do is compare the city_id in the row you are looking at with the city_id coming in and mark it as selected when you find it:
Code:
while ($row = $result->fetch_assoc())
{
$name = $row['city_name'];
$city_id = $row['city_id'];
echo "<option value=" . $city_id
if($row['city_id']==$idin)
{
echo " selected ";
}
echo ">$name</option>";
}
Something like that. (edited in: that assumes that you already pulled the city_id coming in into $idin)