Well I can get Part of the page to load But the Second part doesnt seem to work.
Its just a TEST page for now so its only pulling the State in one drop down and areacode FOR that state in another dropdown.
Once it works it will be used to get the states for any country.
The problem is i cant seem to get the Areacode part to work. here is the Dbase info
Dbase = test
Table1 = state
Fields = Name, ID
Table2 = areacode
Fields = Code, state
The Primary Key is ID and the Relative fieldd would be ID and state. So if the ID for alabama is 1 Then it should Pull from areacode anything that has 1 in the state field. Its not being a happy camper. I would appreciate any help.
heres my code below,
<?
mysql_connect("Server", "name", "password") or
Die ("could not connect to DB");
mysql_select_db("test")or
Die ("could not Select DB");
$Result1 = mysql_query ("select * from state") or
Die (mysql_error());
$Result2 = mysql_query ("Select * from areacode where state = '".${"ID"}."'") or
Die (mysql_error());
?>
<? while ($recB = mysql_fetch_array($Result2)) { ?>
<? echo ("$recB"); ?>
<? }?>
<form method="post" name="signup" action="<?= $PHP_SELF ?>">
<select name="xcountry" onchange="document.signup.elements['State'].value = this.options[this.options.selectedIndex].value; document.signup.submit()">
<? while ($recA = mysql_fetch_array($Result1)) { ?>
<option value=http://www.phpbuilder.com/board/archive/index.php/"<? echo $recA["Name"]; ?>"> <? echo $recA["Name"]; ?> </option>
<? } ?>
</select>
<select name="areacode">
<? while ($recB = mysql_fetch_array($Result2)) { ?>
<option value="<? echo $recB["Code"]; ?>"> <? echo $recB["Code"]; ?> </option>
<? } ?>
</select>
<input type="hidden" name="state" value="">
<input type="hidden" name="Code" value="">
</form>
Its just a TEST page for now so its only pulling the State in one drop down and areacode FOR that state in another dropdown.
Once it works it will be used to get the states for any country.
The problem is i cant seem to get the Areacode part to work. here is the Dbase info
Dbase = test
Table1 = state
Fields = Name, ID
Table2 = areacode
Fields = Code, state
The Primary Key is ID and the Relative fieldd would be ID and state. So if the ID for alabama is 1 Then it should Pull from areacode anything that has 1 in the state field. Its not being a happy camper. I would appreciate any help.
heres my code below,
<?
mysql_connect("Server", "name", "password") or
Die ("could not connect to DB");
mysql_select_db("test")or
Die ("could not Select DB");
$Result1 = mysql_query ("select * from state") or
Die (mysql_error());
$Result2 = mysql_query ("Select * from areacode where state = '".${"ID"}."'") or
Die (mysql_error());
?>
<? while ($recB = mysql_fetch_array($Result2)) { ?>
<? echo ("$recB"); ?>
<? }?>
<form method="post" name="signup" action="<?= $PHP_SELF ?>">
<select name="xcountry" onchange="document.signup.elements['State'].value = this.options[this.options.selectedIndex].value; document.signup.submit()">
<? while ($recA = mysql_fetch_array($Result1)) { ?>
<option value=http://www.phpbuilder.com/board/archive/index.php/"<? echo $recA["Name"]; ?>"> <? echo $recA["Name"]; ?> </option>
<? } ?>
</select>
<select name="areacode">
<? while ($recB = mysql_fetch_array($Result2)) { ?>
<option value="<? echo $recB["Code"]; ?>"> <? echo $recB["Code"]; ?> </option>
<? } ?>
</select>
<input type="hidden" name="state" value="">
<input type="hidden" name="Code" value="">
</form>