View Single Post
Old 06-14-2011, 07:05 PM  
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
How would you do the same but this time fetch data from a mysql table then display it in a select form field and have the value stored in the model_in_city table as selected?

Here's what I have so far but every city is being displayed in its own dropdown menu.

Code:
<?php

include("../includes/connect.php");

$query = "SELECT * FROM city";
if ($result = $db->query($query)) {

  while ($row = $result->fetch_assoc()) {
  
  $name = $row['city_name'];
  
  echo "<select name=\"select\">";
  echo "<option>$name</option>";
  echo "</select>";
}
$result->free();
}
$db->close();

?>
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote