View Single Post
Old 06-14-2011, 09:17 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,196
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)
__________________
All cookies cleared!

Last edited by sarettah; 06-14-2011 at 09:19 PM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote