hansman Posted May 12, 2009 Share Posted May 12, 2009 Hello, currently I have a search field that searches a given database given a zip code, then pulls out the info it finds. The link for the results is www.mysite.com/results.php. Users canngive this link out as it wont show any information. How can i change the script so it would appear something like www.mysite.com/results.php"?ZIPCODE" currently the php of results.php looks something like this <title><?php echo $_POST['zipcode']; ?></title> <? include_once("header.php"); ?> <div class="topcontent"></div><div class="morewrap"><div class="content"> <? $zip = $_POST['zipcode']; if (preg_match("/^\w{1,10}$/", $zip, $matches)) { $query = "SELECT * FROM Companies, Zips, Zips_To_Company WHERE Zips_To_Company.company_id = Companies.company_id AND Zips_To_Company.zip_id = Zips.ZipCode AND Zips_To_Company.zip_id = '$zip' ORDER BY Rank ASC "; } else{ // we don't bother querying the database echo "Not A Valid Zip Code"; } $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ echo "<span class=\"profile\"> <h2>".$row['CName']. "</h2><br>Located at: " . $row['Address']; echo ", ".$row['StateAbbr'] . "<br> Phone Number <b>" . $row['Phone']."</b><br>" ."Fax: ". $row['Fax']. "<br><b>Services:</b><br>". $row['Services'] . "<br><a href=http://".$row['Website']."> Visit ". $row['CName'] ."'s Website</a><br><a href= Mailto:".$row['email'].">Email ". $row['CName']."</a></span><br>"; } ?> Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted May 12, 2009 Share Posted May 12, 2009 You're using POST, just use GET. $_GET['zipcode'] Quote Link to comment Share on other sites More sharing options...
hansman Posted May 12, 2009 Author Share Posted May 12, 2009 thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.