I have a select box which chooses category and on that basis the sub category is shown in the another dropdown with multipl selection property
both the drop down are filled with values from mysql tables using php and mysql
now the problem is I want to fetch the records from item table based on the multiple selected sub categories which further is also a dropdown after which the user selects the items and enters the qty .The below passes the category,sub-category details using javascript url get method
both the drop down are filled with values from mysql tables using php and mysql
now the problem is I want to fetch the records from item table based on the multiple selected sub categories which further is also a dropdown after which the user selects the items and enters the qty .The below passes the category,sub-category details using javascript url get method
Code:
<html><body><form method="post">
<? $sqlh="select subcategory,sub_desc,category from sub_master where closed='N'";
$db_queryh=$DB_site->query($sqlh);
$sqlcombo='' ?>
<tr>
<td><strong>Select Sub-category</strong>
<select name='article[ ]' id='article[ ]' class="combo" multiple>
<option value=" ">--Select sub category--</option>
<? while($resulth=$DB_site->fetch_array($db_queryh)){
$sqlcombo=$sqlcombo."<option value= '". $resulth['subcategory']."'";
if($resulth['subcategory']==$subcategory){
$sqlcombo=$sqlcombo."selected";
}
$sqlcombo=$sqlcombo.">".$resulth["sub_desc"].' { '.htmlspecialchars($resulth["subcategory"])."}</option>\n";
}
echo $sqlcombo;
?>
</select> </td>
</tr>
<input type="button" name="button" value="ok" onChange="detchk();">
<script>
function detchk(){
for (var i=1; i<=r; i++)
{
if (document.getElementById("sub_category").options[i].selected){
arval[s]=document.getElementById("sub_category").options[i].value;
alert(arval[s]);
s++;
count++;
}
}
//new url passes has all the category and subcategory to pass as get method
document.location.href=newurl
}
</script>