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? Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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']; Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.