MySQL Forums
Forum List  »  Newbie

Re: zip code calculation by user input
Posted by: Claude Martin
Date: April 04, 2005 12:44AM

this is very basic php. you should search for a php tutorial of buy a book about php & mysql.

did i get that right:
*_zip are both numerical? (because else you's need to add slashes so that special characters can be fount too).
there is only one result when someone searches for two values for org_zip and dest_zip?

try this code:
<?
if($_POST[submit]) {
//replace "tablename" with the name of the table!!!
$sql = mysql_query("SELECT value FROM tablename WHERE `org_zip` = '$_POST[org_zip]' AND `dest_zip` = '$_POST[dest_zip]' LIMIT 1"); //only one row...
$row = mysql_fetch_assoc($sql);
echo "<h1>The value is: $row[value]</h1>";
}
?>
<form method=post>
org_zip: <input type=text name="org_zip" value="<?=$_POST[org_zip]?>"><br>
dest_zip: <input type=text name="dest_zip" value="<?=$_POST[dest_zip]?>"><br>
<input type=submit name=submit value=go>
</form>

http://animalliberation.tk http://veganismus.ch
http://maqi.de http://tierrechtskochbuch.de

Options: ReplyQuote


Subject
Written By
Posted
April 04, 2005 01:56AM
Re: zip code calculation by user input
April 04, 2005 12:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.