Jump to content


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


dynamic page creation

Recommended Posts

I have a page that grabs all products matching the selected category from mysql and outputs them on the page.  I was wondering how I can set these products up as links where when clicked on it will take you to a whole new page which shows that single product.  If anyone could give me an idea on where to start that would be great.  It seems to my I would have to create new php files when the link was clicked on.  Is this correct.

Share this post

Link to post
Share on other sites
Actually you would be better off making a template. Then when the list of products comes up you set a link to to the template with a parameter to grab the product they want to look at.

so your link will go to a page called details.php

you link will look like this.
[code]echo '<a href="details.php?id='.$row['id'].'">';[/code]
$row['id'] is the field retrieved from the query

Then on the details page your write a query to retrieve that product

$p_id = $_GET['id'];
$sql = "SELECT * FROM table WHERE id = '$p_id'";

Now you only need one page and the product details are fetched from the query and put in the page.


Share this post

Link to post
Share on other sites


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.