justlukeyou Posted May 14, 2012 Share Posted May 14, 2012 Hi, I have a database which can echo a range of products and I have a page which will echo 1 single product. However, these are completely seperate. Can someone please advise how I can link from a multiple list of products onto a single product page? Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/ Share on other sites More sharing options...
Barand Posted May 15, 2012 Share Posted May 15, 2012 put a link on eachitem http://www.w3schools.com/tags/tag_a.asp Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/#findComment-1345480 Share on other sites More sharing options...
justlukeyou Posted May 15, 2012 Author Share Posted May 15, 2012 Thanks, So on the multiple products page I need to create a query link which has the ID echoed into it (product.php?='echo ID') ...something like that. So lets say the cheapest item is ID 222 this will be first item if I sort it by cheapest item. How do I tell the single product page that someone has clicked on ID 222. Do you use a GET command to get the chosen ID from the multiple product page? Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/#findComment-1345533 Share on other sites More sharing options...
Barand Posted May 15, 2012 Share Posted May 15, 2012 If the link is like this <a href='product.php?id=222'>Widget</a> then in product.php $prodId = $_GET['id']; Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/#findComment-1345539 Share on other sites More sharing options...
justlukeyou Posted May 15, 2012 Author Share Posted May 15, 2012 Brilliant thanks. "$prodId" what does prodId relate to. I was planning to create a row in the MySQL database with ID and increments by 1 for each new entry and call it "ID" Is it best to call it prodId? Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/#findComment-1345557 Share on other sites More sharing options...
Barand Posted May 15, 2012 Share Posted May 15, 2012 Just a variable name, any will do. I was merely demonstrating how you get the value of id from the querystring using the $_GET array Link to comment https://forums.phpfreaks.com/topic/262529-linking-to-a-single-product-page/#findComment-1345558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.