Week 3 Discussion
Graded Discussion - Create your own Unique Nested Loop with Data
Create your own simple, nested for loop that display data in an HTML table. Choose a theme and data set of your choice. Select something, no one else has already provided.
You should use both PHP and html tags in your example. Your code should run without issue on a web server.
Explain your code and demonstrate it runs properly using screen shots. - DUE THURSDAY, SEPTEMBER 8TH, 2016 AND BELOW PART IS DUE A FEW DAYS LATER!
Respond to other student posting by changing parts of the code to enhance the functionality. Two I chose to respond to are listed below!
1. W3 Disc - Kacey
Nested for each loop. It basically runs through the values in the array and outputs each value in a new <td>
Screen shot is at http://prntscr.com/cfu32m (no source code file was given)
2. Jonathan Barnes - Create your own Unique Nested Loop with Data
Screen shot at http://prntscr.com/cfu3tu (Source code is below)
Here is my code that builds a table listing different artists, the price of their CD, and their top 40 ranking.
The first row is completely static and is built with the first section of code.
Column 1, row 2, 3, 4, column 2, row 2, 3, 4, and column 3, row 2, 3, 4 are built with the second section of code using an array.
Finally, columns 4, 5, 6, 7 and their respective 2nd, 3rd, and 4th rows are built using the nested for loop in the third section of codeHere is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" >
<html>
<body>
<!--FIRST SECTION-->
<table border="1">
<tr>
<td>Artist</td>
<td>CD's Price</td>
<td>Total Price Plus Tax (6%)</td>
<td>TOP40_peak</td>
<td>1st Week</td>
<td>2nd Week</td>
<td>3rd Week</td>
</tr>
<!--SECOND SECTION-->
<?php
$artists = array("Eminem", "Adele", "Seether");
$price = array(10,20,30);
$artistsarraylength = count($artists);
$tax = 0.06;
$standing = array(1, 1, 6, 8);
$standingarraylength = count($standing);
for($artist = 0; $artist < $artistsarraylength; $artist++) {
?>
<tr>
<td> <?php echo $artists[$artist]?> </td>
<td> <?php echo $price[$artist]?> </td>
<td> <?php echo $price[$artist] + $price[$artist] * $tax?> </td>
<!--THIRD SECTION-->
<?php
for($y = 0; $y < $standingarraylength; $y++) {
?>
<td> <?php echo $standing[$y] + $artist + 5?> </td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</body>
</html>.
10 years ago
20
Purchase the answer to view it

- week_3_discussion.docx
- week_3_discussion.docx
- Crim 15 pages Pin It Final Project Analysis of an Offender (15 pages As a criminal justice professional, you will likely deal with offenders on a daily basis. Understanding the causes of criminal behavior is essential to learning how to handle offend
- According to the CAPM, what would be the required return on an asset that has a beta of 1.35
- Hi Attached is the study guide and brief proposal of what was submitted. The assignment will need to base on the question...
- Persuasive Message
- ASSIGNMENT 04
- Unit 8 Seminar
- BUS1A ch 9
- Unit 2 Health IP
- INV IP 1
- Statistics homework