Re: A real problem
| From: | Daniel Clark | Date: | Mon, 26 Apr 2004 18:53:23 +0000 |
| Subject: | Re: A real problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184686@lists.php.net to get a copy of this message | ||
Yes, put your shop_models query and output within your shop_brands.
> 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
>
>
>