chornbeck
04-24-2006, 07:41 PM
I have a script that takes a form input, which is a person's ZIP code. The php then runs the first query, which gets the latitude and longitude coordinates from the DB based on the ZIP. What I need to do is have some sort of error handling function that returns an error message if the ZIP code being searched for is not in the database, or if the person enters something besides a ZIP code, etc...
All I need is for it to say the ZIP code you entered is not a valid ZIP code, and then a "Try Again" link...
<?
if($_POST['submit'])
{
$dbh=mysql_connect ("localhost", "orlandoi_gmap", "gmap") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("orlandoi_gmap");
$InputtedZIP = ($_POST['InputtedZIP']);
$inputCoords = mysql_query("Select LAT, LNG from coord_db where ZIP = $InputtedZIP") or die(mysql_error());
while($row = mysql_fetch_array($inputCoords))
{
?>
<tr>
<td><font color=#000000 face="arial">Map has been generated showing all ZIP Codes containing a Festiva Owner within a 50 mile radius of the ZIP code <?php echo $InputtedZIP;?></td>
All I need is for it to say the ZIP code you entered is not a valid ZIP code, and then a "Try Again" link...
<?
if($_POST['submit'])
{
$dbh=mysql_connect ("localhost", "orlandoi_gmap", "gmap") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("orlandoi_gmap");
$InputtedZIP = ($_POST['InputtedZIP']);
$inputCoords = mysql_query("Select LAT, LNG from coord_db where ZIP = $InputtedZIP") or die(mysql_error());
while($row = mysql_fetch_array($inputCoords))
{
?>
<tr>
<td><font color=#000000 face="arial">Map has been generated showing all ZIP Codes containing a Festiva Owner within a 50 mile radius of the ZIP code <?php echo $InputtedZIP;?></td>