Forum Moderators: coopster
I have 3 select boxes and when the user makes his selection on the first one I like the options on the other two to change.
If there is no solution since php is server side the first select box could also be links. I have only 4 items in there.
The js stuff had codes to recognice what type of browser the client is using and that just turns me off.
Here is the link to the js I found:
[p2p.wrox.com...]
if you're willing to refresh the page based on the input in the first select then PHP can do it, otherwise it's client side JS
i posted this on a similar thread a while back but the principal is the same. using JS onchange; to refresh the form
<?php
// DBASE CONECT HERE
//
if (isset($_POST['finalsubmit']))
{
// PROCEED TO NEXT FORM
}
else
{
if (isset($_POST['select1']) && $_POST['select1']!=0)
{
$result=mysql_query("SELECT * FROM states WHERE country_id=$_POST[select1] ");
$thestates='STATES <select name="states">';
while($row=mysql_fetch_array($result))
{
// RETURN DETAILS OF THE COUNTRY CHOSEN
$thestates.='<option value="'.$row[State_ID].'">'.$row[State].'</option>';
}
$thestates.='</select>';
}
}
?>
<html>
<head>
<SCRIPT language="JavaScript">
function submitform()
{
document.form1.submit();
}
</SCRIPT>
</head>
<body>
<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF];?>">
<select name="select1" onChange="javascript:submitform();">
<option value="0" selected>Please Choose a Country</option>
<option value="1">UK</option>
<option value="2">USA</option>
</select>
<?php echo $thestates;?>
<Br><br>
<input type="submit" name="finalsubmit" value="FINAL SUBMIT">
</form>
</body></html>
hope that helps
hughie