psarangaya13
12-16-2009, 05:53 AM
Hi Guys,
I have 3 Dynamic Drop Down List.
Brand -> Category -> Item
if you choose Acer -> Brand
it will only show what type of Acer Category -> Category
after choosing what category, it will show in the last drop down list the
available acer item.
my problem is,
after clicking the Item.
i want to show it's CONTENT of the item, in my black space.
Here's my javascript for URL:
<SCRIPT language=JavaScript>
function reload(form)
{
var brand1=form.brand.options[form.brand.options.selectedIndex].value;
self.location='products.php?brand=' + brand1 ;
}
function reload3(form)
{
var brand1=form.brand.options[form.brand.options.selectedIndex].value;
var category2=form.category.options[form.category.options.selectedIndex].value;
self.location='products.php?brand=' + brand1 + '&model=' + category2 ;
}
</script>
Here's my code in the 3 Drop Down List:
<?php
$quer2=mysql_query("SELECT DISTINCT brand,content_id FROM tblbrand order by brand");
$brand=$HTTP_GET_VARS['brand'];
if(isset($brand) and strlen($brand) > 0){
$quer=mysql_query("SELECT DISTINCT category,category_id FROM tblcategory where content_id=$brand order by category");
} else {$quer=mysql_query("SELECT DISTINCT category,category_id FROM tblcategory order by category"); }
$model=$HTTP_GET_VARS['model'];
if(isset($model) and strlen($model) > 0){
$quer3=mysql_query("SELECT DISTINCT model_id, category_id, model, content FROM tblmodel where category_id=$model order by model");
} else {$quer3=mysql_query("SELECT DISTINCT model_id, category_id, model, content FROM tblmodel order by model"); }
echo "<form method=get name=f1>";
echo "<select name='brand' onchange=\"reload(this.form)\"><option value=''>Select Brand</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['content_id']==@$brand){echo "<option selected value='$noticia2[content_id]'>$noticia2[brand]</option>"."<BR>";}
else{echo "<option value='$noticia2[content_id]'>$noticia2[brand]</option>";}
}
echo "</select>";
echo " > <select name='category' onchange=\"reload3(this.form)\" ><option value=''>Select Category</option>";
while($noticia = mysql_fetch_array($quer)) {
if($noticia['category_id']==@$model){echo "<option selected value='$noticia[category_id]'>$noticia[category]</option>"."<BR>";}
else{echo "<option value='$noticia[category_id]'>$noticia[category]</option>";}
}
echo "</select>";
echo " > <select name='model' ><option value=''>Select Model</option>";
while($noticia = mysql_fetch_array($quer3)) {
echo "<option value='$noticia[model]'>$noticia[model]</option>";
}
echo "</select>";
echo "<input type=submit value='Search'></form>";
?>
.......................................................................................................
Under tblmodel in mysql, where my content is.
......................................................................................................
How can i command to show its content in my black space?
Hope somebody will help me with my dilemma. :(
Thanks!
I have 3 Dynamic Drop Down List.
Brand -> Category -> Item
if you choose Acer -> Brand
it will only show what type of Acer Category -> Category
after choosing what category, it will show in the last drop down list the
available acer item.
my problem is,
after clicking the Item.
i want to show it's CONTENT of the item, in my black space.
Here's my javascript for URL:
<SCRIPT language=JavaScript>
function reload(form)
{
var brand1=form.brand.options[form.brand.options.selectedIndex].value;
self.location='products.php?brand=' + brand1 ;
}
function reload3(form)
{
var brand1=form.brand.options[form.brand.options.selectedIndex].value;
var category2=form.category.options[form.category.options.selectedIndex].value;
self.location='products.php?brand=' + brand1 + '&model=' + category2 ;
}
</script>
Here's my code in the 3 Drop Down List:
<?php
$quer2=mysql_query("SELECT DISTINCT brand,content_id FROM tblbrand order by brand");
$brand=$HTTP_GET_VARS['brand'];
if(isset($brand) and strlen($brand) > 0){
$quer=mysql_query("SELECT DISTINCT category,category_id FROM tblcategory where content_id=$brand order by category");
} else {$quer=mysql_query("SELECT DISTINCT category,category_id FROM tblcategory order by category"); }
$model=$HTTP_GET_VARS['model'];
if(isset($model) and strlen($model) > 0){
$quer3=mysql_query("SELECT DISTINCT model_id, category_id, model, content FROM tblmodel where category_id=$model order by model");
} else {$quer3=mysql_query("SELECT DISTINCT model_id, category_id, model, content FROM tblmodel order by model"); }
echo "<form method=get name=f1>";
echo "<select name='brand' onchange=\"reload(this.form)\"><option value=''>Select Brand</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['content_id']==@$brand){echo "<option selected value='$noticia2[content_id]'>$noticia2[brand]</option>"."<BR>";}
else{echo "<option value='$noticia2[content_id]'>$noticia2[brand]</option>";}
}
echo "</select>";
echo " > <select name='category' onchange=\"reload3(this.form)\" ><option value=''>Select Category</option>";
while($noticia = mysql_fetch_array($quer)) {
if($noticia['category_id']==@$model){echo "<option selected value='$noticia[category_id]'>$noticia[category]</option>"."<BR>";}
else{echo "<option value='$noticia[category_id]'>$noticia[category]</option>";}
}
echo "</select>";
echo " > <select name='model' ><option value=''>Select Model</option>";
while($noticia = mysql_fetch_array($quer3)) {
echo "<option value='$noticia[model]'>$noticia[model]</option>";
}
echo "</select>";
echo "<input type=submit value='Search'></form>";
?>
.......................................................................................................
Under tblmodel in mysql, where my content is.
......................................................................................................
How can i command to show its content in my black space?
Hope somebody will help me with my dilemma. :(
Thanks!