come on guys I nedsome help here! MySQL Rocks
I have a set of drop downs I want to determine the dropdown menu by query?
I have:
<?
require("connection.php");
mysql_connect("$DBHost", "$DBUser", "$DBPass") or
die("could not connect");
mysql_select_db("$DBName");
echo "<select name=\"CountyID\" size=\"1\" class='menuForm'>";
$result=mysql_query("SELECT County, CountyID FROM county ORDER BY County");
while ($row = mysql_fetch_array($result))
{
$county_id=$row['CountyID'];
$county=$row['County'];
echo "<option value=\"$county_id\"> $county </option>";
}
echo "</select>";
?>
which takes us to:
<?
echo "<select name=\"CityID\" size=\"1\" class='menuForm'>";
$result=mysql_query("SELECT City, CityID FROM city ORDER BY City");
while ($row = mysql_fetch_array($result))
{
$city_id=$row['CityID'];
$city=$row['City'];
echo "<option value=\"$city_id\"> $city </option>";
}
echo "</select>";
?>
<br />
<?
but I want the city selction to be only where it is associated with the county?
#
# Table structure for table `city`
#
CREATE TABLE city (
CountyID int(10) unsigned NOT NULL default '0',
City varchar(100) NOT NULL default '',
CityID bigint(20) NOT NULL auto_increment,
PRIMARY KEY (CityID),
KEY CountyID (CountyID)
);
Andrew
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php