Relatively new to PHP and modifying someones code. What I need to do is when I go to a page, there are 2 drop downs. Want to hide the second drop down until they make a selection. Then rehide it if they want to start from the beginning again. I found the command to hide initially. What I am not sure of is in PHP, how to call/pass/set a variable between the code.
In the one .php here is the code with the non variable Hide command. Subcat is what is hidden.
<FORM name="drop_list" action="game-detail.php" method="POST" >
<SELECT id="Category" NAME="Category" onChange="SelectSubCat();" >
<Option value="">Category</option>
</SELECT>
<SELECT id="SubCat"onChange="SelectSubCat2();" NAME="SubCat" style="visibility=hidden;">
<option value="" selected>SubCat</option>
</SELECT>
<br><br>
<select id="Themes" onchange=SelectSubCat();SelectSubCat2();" onclick="this.form.submit();" name="Themes" size="5">
<option value="" selected>Themes</option>
<br><br>
<input type="reset" name="Reset" OnClick="ResetAll();" value="New Search">
when the onchange=selectsubcat is active, I call this code in another page. This is where I need to set to unhide.
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "SubCat", "");
removeAllOptions(document.drop_list.Themes);
<?php
foreach ($tblThemeGroupArray as $tblThemeGroupTypeInfo){
echo "if(document.drop_list.Category.value == \"".$tblThemeGroupTypeInfo[0]."\"){\n";
$themeInfo=mysql_query("SELECT ThemeRecordId, ThemeName, ThemeMark FROM tblThemes
Where Active=\"Yes\" and ThemeGroupTypeID= ". $tblThemeGroupTypeInfo[0]." ORDER BY ThemeName", $linkID3);
$LicenceInfo=mysql_query("SELECT DISTINCT tblLicense.`LicenseID`, tblLicense.LicenseDescription
FROM `tblLicense` Inner join tblThemes on tblLicense.LicenseID=tblThemes.LicenseID
where tblThemes.Active=\"Yes\" and ThemeGroupTypeID= ". $tblThemeGroupTypeInfo[0]. " ORDER BY tblLicense.LicenseDescription" , $linkID4);
// ** Put The Category License and Theme Information info in an array
$LicenceInfoArray=Array();
$counter=0;
//$rrows = mysql_num_rows($LicenceInfo);
//while($row = mysql_fetch_row($LicenceInfo)){
// array_push($LicenceInfoArray, $row);
//}
$inside_counter=1;
while($Licence = mysql_fetch_row($LicenceInfo)){
// array_push($LicenceInfoArray, $Licence);
echo "addOption(document.drop_list.SubCat,\"".$Licence[0]."\", \"".$Licence[1]."\");\n";
//echo "addOption(document.drop_list.Themes,\"".$theme[0]."\", \"".$theme[1]."\");\n";
}
while($theme= mysql_fetch_row($themeInfo)){
//echo "addOption(document.drop_list.SubCat,\"".$Licence[0]."\", \"".$Licence[1]."\");\n";
echo "addOption(document.drop_list.Themes,\"".$theme[0]."\", \"".$theme[1]."\");\n";
}
echo "}\n";
}
echo "}\n";
In the one .php here is the code with the non variable Hide command. Subcat is what is hidden.
<FORM name="drop_list" action="game-detail.php" method="POST" >
<SELECT id="Category" NAME="Category" onChange="SelectSubCat();" >
<Option value="">Category</option>
</SELECT>
<SELECT id="SubCat"onChange="SelectSubCat2();" NAME="SubCat" style="visibility=hidden;">
<option value="" selected>SubCat</option>
</SELECT>
<br><br>
<select id="Themes" onchange=SelectSubCat();SelectSubCat2();" onclick="this.form.submit();" name="Themes" size="5">
<option value="" selected>Themes</option>
<br><br>
<input type="reset" name="Reset" OnClick="ResetAll();" value="New Search">
when the onchange=selectsubcat is active, I call this code in another page. This is where I need to set to unhide.
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "SubCat", "");
removeAllOptions(document.drop_list.Themes);
<?php
foreach ($tblThemeGroupArray as $tblThemeGroupTypeInfo){
echo "if(document.drop_list.Category.value == \"".$tblThemeGroupTypeInfo[0]."\"){\n";
$themeInfo=mysql_query("SELECT ThemeRecordId, ThemeName, ThemeMark FROM tblThemes
Where Active=\"Yes\" and ThemeGroupTypeID= ". $tblThemeGroupTypeInfo[0]." ORDER BY ThemeName", $linkID3);
$LicenceInfo=mysql_query("SELECT DISTINCT tblLicense.`LicenseID`, tblLicense.LicenseDescription
FROM `tblLicense` Inner join tblThemes on tblLicense.LicenseID=tblThemes.LicenseID
where tblThemes.Active=\"Yes\" and ThemeGroupTypeID= ". $tblThemeGroupTypeInfo[0]. " ORDER BY tblLicense.LicenseDescription" , $linkID4);
// ** Put The Category License and Theme Information info in an array
$LicenceInfoArray=Array();
$counter=0;
//$rrows = mysql_num_rows($LicenceInfo);
//while($row = mysql_fetch_row($LicenceInfo)){
// array_push($LicenceInfoArray, $row);
//}
$inside_counter=1;
while($Licence = mysql_fetch_row($LicenceInfo)){
// array_push($LicenceInfoArray, $Licence);
echo "addOption(document.drop_list.SubCat,\"".$Licence[0]."\", \"".$Licence[1]."\");\n";
//echo "addOption(document.drop_list.Themes,\"".$theme[0]."\", \"".$theme[1]."\");\n";
}
while($theme= mysql_fetch_row($themeInfo)){
//echo "addOption(document.drop_list.SubCat,\"".$Licence[0]."\", \"".$Licence[1]."\");\n";
echo "addOption(document.drop_list.Themes,\"".$theme[0]."\", \"".$theme[1]."\");\n";
}
echo "}\n";
}
echo "}\n";