that the Old on i was working on? It worked but it was somthing i dunno what it was..
HERES the good news. I got it working by converting the code to php and making minor modifications :-))
Heres teh script so OTHERS can use it too.
<?
$Host = "localhost";
$DBUser = "username";
$DBPass = "password";
$DBName = "test";
$objConn=mysql_connect($Host,$DBUser,$DBPass);
mysql_select_db($DBName,$objConn);
$showstate=${"showstate"};
if ($showstate=="")
{
$showstate=2;
}
else
{
$showstate=intval($showstate);
}
?>
<script>
function swapit(id){
document.regform.showstate.value = id
document.regform.action = "seltest.php"
document.regform.submit()
}
</script>
<form name="regform" method="post" action="somefile.php">
<input type="hidden" name="showstate" value="<? echo ${"showstate"}; ?>">
<Select name="state" onchange="swapit(this.options[this.options.selectedIndex].value)">
<option value="-1"> chose a state </option>
<?
$res_query=mysql_query(("Select * from state"),$objConn);
$res=mysql_fetch_array($res_query);
while(!($res==0))
{
$stateid=$res["id"];
$statename=$res["statename"];
?>
<option value="<? echo $stateid; ?>" <? if ($stateid==$showstate)
{
?>selected<? } ?>><? echo $statename; ?></option>
<?
$res=mysql_fetch_array($res_query);
}
?>
</select>
<? if ($showstate!="")
{
?>
<Select name="areacode">
<?
$res_query=mysql_query(("Select * from areacode where stateid = '".$showstate."'"),$objConn);
$res=mysql_fetch_array($res_query);
while(!($res==0))
{
$areaid=$res["id"];
$areacode=$res["areacode"];
$stateid=$res["stateid"];
?>
<option value="<? echo $areaid; ?>"><? echo $areacode; ?></option>
<?
$res=mysql_fetch_array($res_query);
}
?>
</select>
<? } ?>
</form>
<?
mysql_close($objConn);
?>