How can a user click a search result for more details?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tom8521
Forum Commoner
Posts: 25
Joined: Thu May 13, 2010 6:24 am

How can a user click a search result for more details?

Post by tom8521 »

I have a property style website where users can find properties against certain criteria.

The relevant results are shown in row format, but how can they then click a specific property result to view full details? - How is this done?

Thanks!
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: How can a user click a search result for more details?

Post by social_experiment »

Create a link to a page that uses some value from the row in the query string. For example :

Code: Select all

<?php echo '<a href="page.name?id=value_from_row">Click here for more details</a>'; ?>
In your browser it will be link and once the user / visitor clicks on the link, they will be taken to the page where the value of 'id' (or whichever value you implement) will dictate the information shown.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
tom8521
Forum Commoner
Posts: 25
Joined: Thu May 13, 2010 6:24 am

Re: How can a user click a search result for more details?

Post by tom8521 »

But if I create an address that moves the user to a page containing a property id, how do i then tell that new page to read the id within the address bar?
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: How can a user click a search result for more details?

Post by flying_circus »

There are several ways to do, the easiest would be to pass a variable in the querystring something like:

http://www.example.org/property.php?property_id=123

You would then use PHP to check if the $_GET variable "property_id" is set, and if it is, pull the properties information from the database.

Code: Select all

if(isset($_GET['property_id'])) {
  # Validate $_GET['property_id'], then check database for property existence and details
} 
Post Reply