I am looking for dynamic lists Product & Release
When I select any option from 'Product' list, 'Release' list should have items releated to selected product.
e.g. Windows ->Win2k, WinXP, Vista
Office -> Word, Excel, Powerpoint
I don't wan't any submit button on it. Also I want selected options to be saved in the form of cookies. So even if i close the brower, it should select last used option in both lists.
e.g. Windows -> WinXP (not the default one)
Please suggest me correction in the following code:
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>Multiple drop down list box from plus2net</title>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.product.options[f
orm.produc
t.options.
selectedIn
dex].value
;
self.location='nav4.php?pr
oduct=' + val ;
}
</script>
</head>
<body>
<?php
if (isset($_COOKIE['product']
))
{
$curProduct=$_COOKIE['prod
uct'];
$release=$_COOKIE['release
'];
setcookie(product,$_GET['p
roduct'],t
ime()+60*6
0*24*30);
setcookie(release,$_GET['r
elease'],t
ime()+60*6
0*24*30);
$curProduct=$_GET['product
'];
}
else
{
$curProduct = "Windows";
setcookie(product,$_GET['p
roduct'],t
ime()+60*6
0*24*30);
}
$Array = array ("Windows", "Office");
echo "<form>";
echo "<p>Product:";
echo "<select name='product' style=\"height: 2em; width: 7em\" onchange=\"reload(this.for
m)\">";
foreach($Array as $product)
{
echo "<option value='".$product."'>".$pr
oduct."</o
ption>";
}
echo "</select>";
if ($curProduct=="Windows")
{
$curReleaseArray= array("Win2k", "WinXP", "Vista");
}
elseif ($curProduct=="Office")
{
$curReleaseArray= array("Word", "Excel", "Powerpoint");
}
//echo "<input type='submit' style=\"height: 1.7em; width: 7em\" value='".$."' name='button'/> ";
echo "<p>Release:";
echo "<select name='release'style=\"heig
ht: 2em; width: 7em\">";
foreach($curReleaseArray as $release)
{
echo "<option value='".$release."'>".$re
lease."</o
ption>";
}
echo "</select>";
echo "<p>";
echo "</form>";