From the course: PHP for Web Designers

Unlock the full course today

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

Controlling which rows are displayed

Controlling which rows are displayed - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Controlling which rows are displayed

The next stage in building the order confirmation page is to make sure that the correct image is displayed for each flower. We also need to prevent a row from being displayed if a flower hasn't been ordered, and if nothing's been ordered, we need to display a message that the customer's basket is empty. The image is, at the moment, hard coded on line 65. What we need to do is, those with a choice of color, are in the color array. And those without a choice of color, are in the image array. So we need an if else structure, to display the correct image. So let's get rid of the, name here. We still need the .JPG. But then we need to add in our PHP code block. And let's just make a few lines there, so we can see where we're working, right? Inside there, what we need is an if/else structure. So, if. And we need to check whether a particular value is set. We're going to look first in the color array. So if is set color, and then the array key will be flower name, so if that is set inside…

Contents