Populated store page, need item page...

So, this is my first post. I am newer to PHP and SQL and I have a site that is run locally right now… it is an online store that populates dynamically based on products in a SQL table. Populating the store was not hard, the products all list and look great, functions well, etc. I have a link setup like this:

<a href="item.php?<?php echo $product_rs['productID']; ?>"> <img src="<?php echo $product_rs['productPic']; ?>" alt="<?php echo $product_rs['altDesc']; ?>" /> </a>

What this does is the picture of the item listed on the products.php (Which pulls the data to display the items in a selected category) - when clicked - loads item.php… I want the item.php to display a different page and pass into it the data from the clicked product, which has a productID… each productID has descriptions, titles, prices, etc.

So my question is this: on one php page (products.php) if I click on the image say for item 19 (productID=19), I then on item.php want to display data / information specific to productID 19, but not sure how to request that on item.php…

I know what I want to do, just having trouble explaining it. Sorry. Thank you.

Also keep in mind this is my first attempt at doing this and it was all self taught… I can post more of the code if I need to.

You would pass the product id in the url. Then, you query for a get variable, $_GET, and based on that id, populate the page.

I thought so, but in trying I’ve not yet figured it out. I’ll keep tinkering. Thank you.

Example: products.php has this code in front of the image:

  <a href="item.php?<?php echo $_GET['productID']; ?>">

So you click on it while on products.php and it should then take you to item.php?15 (if you clicked product 15). It does do that. Now, on item.php, it loads picture and data I want, but ONLY for the first item in the database, not row 15…

Your product listing page,
[php][/php]

The individule product page.
[php]

<?php echo htmlentities($_GET['productID']);[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service