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!
How can a user click a search result for more details?
Moderator: General Moderators
- 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?
Create a link to a page that uses some value from the row in the query string. For example :
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.
Code: Select all
<?php echo '<a href="page.name?id=value_from_row">Click here for more details</a>'; ?>“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
Re: How can a user click a search result for more details?
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?
- 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?
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.
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
}