A result is intended to show the correct county for the city given in the form. I can not seem to get a result even though the request is being passed from the form to the script.
---- The form text box has a name of 'citcnt'
---- County table
cntid int(11) -- autoincrement -- primary index
cnt varchar(30)
---- Example data (cntid, cnt)
1, Alameda
2, Alpine
3, Amador
----- City table
citid int(11) -- autoincrement -- primary index
cntid int(11)
cit varchar(30)
---- Example data (cntid, cit)
1, Albany
2, Berkley
3, Castro Valley
----- find.php
<?
$dbnm = "xxx";
$con = mysql_connect("xxx", "xxx", "xxx") or die("Could not connect.");
$db = mysql_select_db($dbnm, $con)or die("Could not Select db.");
$sql = 'SELECT cnt.cnt FROM cnt, cit where cit.cntid = cnt.cntid and cit.cit = \'$citcnt\'';
$result = mysql_query($sql, $con) or die("Could not display.");
while($row = mysql_fetch_array($result)) {
$cnty = $row['cnt.cnt'];
}
?>
<html>
<head>
<title>con test</title>
</head>
<body>
-- This just validates that the form variable did get transfered to the script. It does.
<? echo "$citcnt"; ?><br>
-- This is supposed to show the result. Idoes not.
<? echo "$cnty"; ?><br>
-- This is to verify that the city requested is indeed the one in the cit database for the county shown. It does not.
<? echo "$cit"; ?><br>
</body>
</html>