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.

Using a loop to build a table for the data

Using a loop to build a table for the data - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Using a loop to build a table for the data

The next stage in processing the data submitted from the Build a bouquet page in the Hansel and Petal site, is to use a for each loop, to display a table row for each type of flower that's been selected. Only two rows are going to be needed in the table at this stage. One for the table headers, and one to go inside the loop to display the order. So let's scroll down and find the table. There it is. It begins there on line 55. The first table row contains the headers, and then there is another table row, and we'd need to get rid of all the remaining table rows. So just scroll down, select them all, and find the end of the table. There it is. And we just, delete that. And we've got, just one row left in the table apart from the, header row. So this is going to be wrapped in a for each loop. And the only array that we've got that contains a value for each flower, is the quantity array. So I'll use the quantity array, for our loop. So let's add a php block here, before the second table…

Contents