A real problem
| From: | Phpu | Date: | Mon, 26 Apr 2004 18:44:02 +0000 |
| Subject: | A real problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184685@lists.php.net to get a copy of this message | ||
Hi
I have this list that interogates the database and display the name of the brand.
<select name="brand">
<?
$query = "SELECT id, name FROM shop_brands";
$result = mysql_query($query) or die("error in query - $query - ".mysql_error());
while($row = mysql_fetch_row($result)) {
list($brand_id, $brand_name) = $row;
$query2 = "SELECT * FROM shop_models WHERE brand_id = $brand_id";
$result2 = mysql_query($query2) or die("error in query - $query2 -
".mysql_error());
$rows = mysql_num_rows($result2);
if($rows) {
$brand_name = htmlspecialchars(stripslashes($brand_name));
if(!$save_brand_id) $save_brand_id = $brand_id;
echo("<option value='$brand_id'>$brand_name</option>");
}
}
?>
each brand has more than one model.
when i chose one of the brands i want to be displayed o form like this (in real time):
$query = "SELECT id, name FROM shop_models WHERE brand_id=$save_brand_id";
$result = mysql_query($query) or die("error in query - $query - ".mysql_error());
while($row = mysql_fetch_row($result)) {
list($model_id, $model_name) = $row;
echo ("<input type='checkbox'
value=\"$model_id\">$model_name\n");
};
How can i do this? (maybe java could help me but i do not know how to do it)
Can someone plese help me?
Thanks for your reply