One page different content.

I just started working with PHP/ MYSQL. This is my first website using them. The website I am working on has many products all located in a mysql table. I have a page set up listing all of the products. I want the user to be able to click on any of the products and have a page that loads with content that changes based on what product the user clicked. I read somewhere that you could do this with the address bar something about a ? followed by the item id but i am not sure. Any help would be greatly appreciated.

Well, if you just want an example of the basics of the superglobal $_GET, then here it comes:

myPage.html:

<a href="myPage.php?itemid=4">Item #4</a>

myPage.php:
[php]

<?php $itemid = $_GET['itemid']; // Thanks to the URL ?itemid=4, $_GET['itemid'] contains the value 4 // do more stuff here ?>

[/php]

You should be able to implement that into your application without a problem.

Thanks for the help that worked perfect.

Sponsor our Newsletter | Privacy Policy | Terms of Service