<?php
require "connection.php";
echo "
function fillCategory(){
";
$q1=mysql_query("select * from group");
echo mysql_error();
while($nt1=mysql_fetch_array($q1)){
echo "addOption(document.drop_list.Main, '$nt1[group]', '$nt1[group]');";
}
function SelectCat(){
removeAllOptions(document.drop_list.Category);
addOption(document.drop_list.Category, "", "Category", "");
$q2=mysql_query("select distinct(group) from category");
while($nt2=mysql_fetch_array($q2)){
echo "if(document.drop_list.Main.value == '$nt2[group]'){";
$q3=mysql_query("select category from category where group='$nt2[group]'");
while($nt3=mysql_fetch_array($q3)){
echo "addOption(document.drop_list.Category,'$nt3[category]', '$nt3[category]');";
}
echo "}";
}
function SelectSubCat(){
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "SubCat", "");
$q4=mysql_query("select distinct(category) from subcategory");
while($nt4=mysql_fetch_array($q4)){
echo "if(document.drop_list.Category.value == '$nt4[category]'){";
$q5=mysql_query("select subcategory from subcategory where category='$nt4[category]'");
while($nt5=mysql_fetch_array($q5)){
echo "addOption(document.drop_list.Main, '$nt1[group]', '$nt1[group]');";
}
?>
}
function SelectCat(){