From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Linking to a details page

Linking to a details page - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Linking to a details page

When you click one of the images in the Mixed Arrangements page of the Hansel & Petal website, it takes you to a details page which contains some hard coded dummy text. It doesn't matter which image you click. You always come back to the same page. So let's adapt this page, so that it loads the details of the correct product. And for it to do so, the links to this details page need to identify which image has been clicked. The main content in the Mixed Arrangements page is being drawn from a database. So if we have a quick look at the database, we can see what we can use to identify each image. And each row in the database table contains an ID. One, two, three, four, five, etcetera. So, we can use that in a query string of our URL. So, let's go to our Editing program. And the link to Details PHP is on line 64. What we need to do is to add query string at the end of that, so question mark, ID equals, and then we need to have a PHP block to show us the ID, the value. And we're going…

Contents