Problem with code....please help
Posted: Sat Jun 03, 2006 2:02 pm
Hi
I am begginer in PHP, please help......I need to build simple "Distance calculation script based on two zip_codes entered by user....
It is almost done.....I need only change some part of PHP code.....please help
Zip code number 1 should go to textfield(zipOne)
Zip code number 2 should go to textfield(zipTwo)
Right now I have something like this:
php:
When I change zip_codes inside code....everything working fine....but it should work from the table....
Thank you for help good people.
I am begginer in PHP, please help......I need to build simple "Distance calculation script based on two zip_codes entered by user....
It is almost done.....I need only change some part of PHP code.....please help
Zip code number 1 should go to textfield(zipOne)
Zip code number 2 should go to textfield(zipTwo)
Right now I have something like this:
php:
Code: Select all
<?php
include_once ("db_mysql.inc");
include_once ("phpZipLocator.php");
$db = new db_sql;
$zipLoc = new zipLocator;
$zipOne = 92126;
$zipTwo = 92109;
$distance = $zipLoc->distance($zipOne,$zipTwo);
?>
<form name="form1" method="post" action="">
<table width="467" height="143" border="0">
<tr>
<td width="152">Enter ZIP_CODE nr 1: </td>
<td width="299"><input name="zipOne" type="text" id="zipOne" size="10" maxlength="5"></td>
</tr>
<tr>
<td>Enter ZIP_CODE nr 2: </td>
<td><input name="zipTwo" type="text" id="zipTwo" size="10" maxlength="5"></td>
</tr>
<tr>
<td> </td>
<td><input name="submmit" type="submit" id="submmit" value="Calculate distance"></td>
</tr>
<tr>
<td colspan="2">
<?php
echo 'Distance between '.$zipOne.' and '.$zipTwo.' is '.number_format($distance,2).' miles.';
?>
</td>
</tr>
</table>
</form>
</body>Thank you for help good people.