<?php
$conn=mysql_connect("localhost","deepak","");
mysql_select_db("fgghghj");
function city()
{
$sql=mysql_query("select distinct city from magnatec where city not in(' ')");
while($row=mysql_fetch_array($sql))
{
print '<option>'.trim($row['city']).'</option>';
}
}
function dealer()
{
$sql=mysql_query("select distinct suburb_location from magnatec where city='$_POST[cit]' AND city not in(' ') AND suburb_location not in(' ')");
while($row=mysql_fetch_array($sql))
{
print '<option>'.$row['suburb_location'].'</option>';
}
}
function show()
{
$sql=mysql_query("select * from magnatec where suburb_location='$_POST[locat]' and suburb_location not in(' ')");
while($row=mysql_fetch_array($sql))
{
print '<td><span class="drbodytext">'.$row['dealer_name'].'</span></td>';
print '<td><span class="drbodytext">'.$row['contact_person'].'</span></td>';
print '<td><span class="drbodytext">'.$row['address'].'</span></td>';
print '<td><span class="drbodytext">'.$row['closest_landmark'].'</span></td>';
print '<td><span class="drbodytext">'.$row['direction_from_landmark'].'</span></td>';
print '<td><span class="drbodytext">'.$row['tel_no'].'</span></td></tr>';
}
}
?>
<html>
<head>
<title>CITY SEARCH</title>
<link rel="stylesheet" type="text/css" href="contentstyles.css">
</head>
<body>
<BR><BR>
<form name="two" method="POST" action="$_SERVER[php_SELF]">
CITY:<select name="cit"><?php city();?>
</select>
<input type="submit" value="Location">
</form>
<BR> <form name="one" method="post" action="$_SERVER[php_SELF]">
LOCATION:<select name="locat"><?php dealer();?>
</select>
<input type="submit" value="Details">
</form><br><br>
<table border=0>
<tr class="bggreen">
<th>DEALER NAME</th><th>CONTACT PERSON</th><th>ADDRESSES</th><th>CLOSEST LANDMARK</th><th>DIRECTION FROM LANDMARK</th><th>TEL. NO</th>
</tr>
<?php show(); ?>
</table>
</body>
</html>