<?php
if(isset($_POST["radio"])){echo "You selected radio button : ".$_POST["radio"]."<br>";}
if(isset($_POST["sel0"])){echo "Select box sel0 = ".$_POST["sel0"]."<br>";}
if(isset($_POST["sel1"])){echo "Select box sel1 = ".$_POST["sel1"]."<br>";}
if(isset($_POST["sel2"])){echo "Select box sel2 = ".$_POST["sel2"]."<br>";}
?>
<html>
<head>
<script>
var sel_1 = new Array(
new Array("0","Education & Reference >","1"),
new Array("0","Health >","2"),
new Array("0","Science & Mathematics >","3")
);
var sel_2 = new Array(
new Array("1","Standards & Testing","1"),
new Array("2","Diseases & Conditions >","2"),
new Array("3","Engineering >","3"),
new Array("3","Biology","4"),
new Array("3","Medicine","5")
);
var sel_3 = new Array(
new Array("2","STDs","1"),
new Array("3","Structral","2")
);
var _path1="";
var _path2="";
var _path3="";
function switch_tab(id)
{
if(id == "tab1")
{
document.getElementById(id).style.background="#eeffdb";
document.getElementById("tab2").style.background="none";
document.getElementById("div_tab1").style.display = "block";
document.getElementById("div_tab2").style.display = "none";
}
if(id == "tab2")
{
document.getElementById(id).style.background="#eeffdb";
document.getElementById("tab1").style.background="none";
document.getElementById("div_tab1").style.display = "none";
document.getElementById("div_tab2").style.display = "block";
}
}
function Populate_select_0()
{
var OptionList=document.frmMain.sel0;
var end_loop=sel_1.length;
for(var i=0;i<end_loop;i++)
{
OptionList[OptionList.length]=new Option(sel_1[i][1],sel_1[i][2]);
}
}
function Populate_select_1(id)
{
if(id.name=="sel0")
{
_path1 = id.options[id.selectedIndex].text;
_path2 = "";
_path3 = "";
var OptionList=document.frmMain.sel2;
for(var x=OptionList.length;x>=0;x--){OptionList[x]=null;}
OptionList=document.frmMain.sel1;
for(var x=OptionList.length;x>=0;x--){OptionList[x]=null;}
var OptionList=document.frmMain.sel1;
var end_loop=sel_2.length;
for(var i=0;i<end_loop;i++)
{
if(id[id.selectedIndex].value==sel_2[i][0])
{
OptionList[OptionList.length]=new Option(sel_2[i][1],sel_2[i][2]);
}
}
}
if(id.name=="sel1")
{
_path3 = "";
_path2 = id.options[id.selectedIndex].text;
var OptionList=document.frmMain.sel2;
for(var x=OptionList.length;x>=0;x--){OptionList[x]=null;}
var end_loop=sel_3.length;
for(var i=0;i<end_loop;i++)
{
if(id[id.selectedIndex].value==sel_3[i][0])
{
OptionList[OptionList.length]=new Option(sel_3[i][1],sel_3[i][2]);
}
}
}
if(id.name=="sel2")
{
_path3 = id.options[id.selectedIndex].text;
}
document.getElementById("sp1").innerHTML = _path1 + _path2 + _path3;
}
</script>
</head>
<body onload="Populate_select_0();">
<div style="">
<form name="frmMain" action="#" method="post">
<div style="border:1px solid #000000;width:725px;height:350px;padding-top:50px;background:#fcfcfc;">
<table style="width:523px;margin-left:123px;" cellspacing=0 cellpadding=0>
<tr>
<td style="width:40%;"><div id="tab1" onclick="switch_tab('tab1');" style="border:1px solid #000000;border-bottom:none;display:inline;background:#eeffdb;height:25px;width:100%;padding:5px;">May We Suggest a Category</div></td>
<td style="width:40%;"><div id="tab2" onclick="switch_tab('tab2');" style="border:1px solid #000000;border-bottom:none;display:inline;height:25px;width:100%;padding:5px;margin-left:10px;">Browse All of Our Categories</div></td>
<td style="border-bottom:1px solid #000000;"> </td>
</tr>
<tr>
<td colspan=3>
<div style="border:1px solid #000000;border-top:none;padding-top:20px;padding-bottom:10px;background:#eeffdb;width:503px;">
<!-- Content tab1 -->
<div id="div_tab1" style="display:block;">
<table style="border:1px solid #000000;width:100%;margin-left:10px;margin-right:10px;" cellpadding=0 cellspacing=0>
<tr style="height:25px;">
<td style="padding:5px;padding-right:10px;"><input type="radio" name="radio" value="Education & Reference > Standards & Testing"></td><td style="padding:5px;padding-left:10px;font-size:18px;">Education & Reference > Standards & Testing</td>
</tr>
<tr style="height:25px;">
<td style="background:#ffffff;padding:5px;padding-right:10px;"><input type="radio" name="radio" value="Health > Diseases & Conditions > STDs"></td><td style="background:#ffffff;padding:5px;padding-left:10px;font-size:18px;">Health > Diseases & Conditions > STDs</td>
</tr>
<tr style="height:25px;">
<td style="padding:5px;padding-right:10px;"><input type="radio" name="radio" value="Science & Mathematics > Engineering"></td><td style="padding:5px;padding-left:10px;font-size:18px;">Science & Mathematics > Engineering</td>
</tr>
<tr style="height:25px;">
<td style="background:#ffffff;padding:5px;padding-right:10px;"><input type="radio" name="radio" value="Science & Mathematics > Biology"></td><td style="background:#ffffff;padding:5px;padding-left:10px;font-size:18px;">Science & Mathematics > Biology</td>
</tr>
<tr style="height:25px;">
<td style="padding:5px;padding-right:10px;"><input type="radio" name="radio" value="Science & Mathematics > Medicine"></td><td style="padding:5px;padding-left:10px;font-size:18px;">Science & Mathematics > Medicine</td>
</tr>
</table>
<div style="margin-top:20px;margin-left:10px;">Or, select a different category from our <a href="#" onclick="switch_tab('tab2');">complete list</a>.</div>
</div>
<!-- Content tab2 -->
<div id="div_tab2" style="display:none;">
<table style="width:100%;margin-left:10px;margin-right:10px;">
<tr>
<td colspan=3 style="font-size:14px;padding-bottom:10px;">Select a category using our category browser below or view <a href="#" onclick="switch_tab('tab1');">Suggested Categories</a></td>
</tr>
<tr>
<td style="width:33%;"><select name="sel0" size=20 style="width:100%;" onChange="Populate_select_1(this);"></select></td>
<td style="width:33%;"><select name="sel1" size=20 style="width:100%;" onChange="Populate_select_1(this);"></select></td>
<td style="width:33%;"><select name="sel2" size=20 style="width:100%;" onChange="Populate_select_1(this);"></select></td>
</tr>
<tr>
<td colspan=3 style="padding-left:10px;"><img src="" style="width:20px;height:20px;">You selected: <span id="sp1" style="font-weight:bold;"></span></td>
</tr>
</table>
</div>
</div>
<div style="text-align:right;padding-right:20px;margin-top:50px;margin-bottom:20px;">
<input type="submit" value="Preview" style="background:#0000ff;color:#ffffff;font-size:16px;font-weight:bold;">
</div>
</td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>