Hi guys i got this problem, i can't seem to be making the linked listboxes staying together. I managed to retrive the data from the database, using the onchange event in the select box, i will retrive the ID selected and popluate the next set of listbox and when i select the 2nd listboxes values to select the 3rd listbox values, the first 2 resets and i been unable to dsbug the problem ? So mind if there is any one out there willing to help me with my plea for help pls ?
Many thanks to for yout help ppl !!

wilson

PHP Code:
<form name = "categoryListBoxForm" action = "deleteOrderForm.php?myValue=<? echo $myValue?>" method = "post">
                  <select name="catListBox" onchange= "categoryListBoxForm.submit()">; 
        
        //**********************************************************************
        //    START OF PHP SCRIPT
        //**********************************************************************
        <?php  
         
        
            $categoryQuery 
"SELECT Category.Category_ID,Category.Category_Name 
                              from Category ORDER BY Category_Name asc"
;
            
            
$categoryQueryResult mysql_query($categoryQuery);
            
            if (!
$categoryQueryResult)
            {
                
$queryInfo "There was an error retrieving records from the database";
                echo 
"error";
                
displayQueryError($queryInfo);
                
            }
            else if (
$categoryQueryResult)
            {    
$blank"--Select Category--";             
                echo 
'<option value="'.$blank.'">'.$blank.'</option>';
            
                while(
$categoryRowmysql_fetch_array($categoryQueryResult ))
                { 
                    
$catID  $categoryRow['Category_ID'];
                    
$catName$categoryRow['Category_Name'];
                
   
                 echo 
'<option value='.$catID.'>'.$catName.'</option>';
                }
//end while
            
}
                        
        
?>
        </select>
        <select name="subCatListBox" onchange= "categoryListBoxForm.submit()">; 
        <? 
         
            $catID 
$_POST['catListBox'];
            
$subCategoryQuery "SELECT Sub_Category.Sub_Category_ID,
                              Sub_Category.Sub_cat_Name 
                              from Sub_Category WHERE Sub_Category.Category_ID = '"
.$catID."'
                              ORDER BY Sub_cat_Name asc"
;
            
            
$subCategoryQueryResult mysql_query($subCategoryQuery);
            
            if (!
$subCategoryQueryResult)
            {
                
$queryInfo "There was an error retrieving records from the database";
                echo 
"error";
                
displayQueryError($queryInfo);
                
            }
            else if (
$subCategoryQueryResult)
            {    
$blank"--Select Sub Category--";             
                echo 
'<option value="'.$blank.'">'.$blank.'</option>';
            
                while(
$subCategoryRowmysql_fetch_array($subCategoryQueryResult))
                { 
                    
$subCatID  $subCategoryRow['Sub_Category_ID'];
                    
$subCatName$subCategoryRow['Sub_cat_Name'];
                
   
                 echo 
'<option value='.$subCatID.'>'.$subCatName.'</option>';
                }
//end while
            
}
            
             echo 
" <input type = \"hidden\" name = \"catIDHiddenBox\" 
                                 value = \""
.$catID."\" size = \"60\">"
        
?>
         
        
        </select>
        <?      $subCatID $_POST['subCatListBox'];
            
$catID    $_POST['catIDHiddenBox'];
            echo 
"catID:";
            echo 
$catID;
            echo 
"</br>";
            echo 
"</br>";
            echo 
"subcatID:";
            echo 
$subCatID;
            echo 
"</br>";
        
?>    
        <select name="productListBox" onchange= "categoryListBoxForm.submit()">; 
        <? 
         
            $subCatID 
$_POST['subCatListBox'];
            
$catID    $_POST['catIDHiddenBox'];
            
            echo 
$catID;
            
$productQuery "SELECT Product.Product_ID,Product.Product_Name
                              from Product WHERE Product.Category_ID = '"
.$catID."'
                              AND Product.Sub_Category_ID = '"
.$subCatID."' 
                              ORDER BY Product_Name asc"
;
            
            
$productQueryResult mysql_query($productQuery);
            
            if (!
$productQueryResult)
            {
                
$queryInfo "There was an error retrieving records from the database";
                echo 
"error";
                
displayQueryError($queryInfo);
                
            }
            else if (
$productQueryResult)
            {    
$blank"--Select Product--";             
                echo 
'<option value="'.$blank.'">'.$blank.'</option>';
            
                while(
$productRowmysql_fetch_array($productQueryResult))
                { 
                    
$productID $productRow['Product_ID'];
                    
$productName $productRow['Product_Name'];
                   
                 echo 
'<option value='.$productID.'>'.$productName.'</option>';
                }
//end while
            
}
            
            
        
?>
         //**********************************************************************
         //    END OF PHP SCRIPT
         //**********************************************************************
        </select>
        </form>