Hi all,
I'm pretty new to PHP and i'm stuck.
I'm trying to query a database full of zip codes by a specific location ID. If the ZIP code entered in the form matches one of the zips associated with the ID i would like it to continue on the next form page. If not, simply say "sorry your zip code not found". Make sense?
Here's what i have so far:
I can get the code to return the first ZIP associated with the locationID, but if i search for any Zips within that location...nothing.PHP Code:<?php
$cxn = mysqli_connect("host","username" ,"pass", "db");
$zipEntry = $_POST['zip'];
$query = "SELECT ZIP FROM ZipCodes WHERE locationID = '550'";
$result = mysqli_query($cxn,$query)
or die ("Couldnt Execute.");
$row = mysqli_fetch_field($result);
if ( $zipEntry == $row['ZIP'] )
{
(go to some page. this i don't know how to code either)
}
{
echo "Sorry your Zip not found";
}
mysqli_close($cxn);
?>
Thanks for the help!



Reply With Quote

Bookmarks