Jump to content

making a page directly accessible


hansman

Recommended Posts

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>"; 
}
?>

Link to comment
https://forums.phpfreaks.com/topic/157864-making-a-page-directly-accessible/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.