Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Hiding/Unhiding a drop list

Status
Not open for further replies.

cranger01

IS-IT--Management
Oct 2, 2006
34
US
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>&nbsp;
<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>
&nbsp;&nbsp;
<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";

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top