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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.