[ Prev ]
2021-02-24

-- Feb 24 In-Class Exercise
<!DOCTYPE html>
<html lang="en-US">
<head>
    <title>My Grocery List</title> 
 
    <meta name="description" content="A table for a menu">
    <meta name="author" content="Mark Silva">
    <meta charset="utf-8"> 
 
    <style>
        table, th, td {
          border: 1px solid black;
          border-collapse: collapse;
        }
    </style>
</head>
<body>
    <h1>My Menu</h1>
    <table>
        <caption>Grocery</caption>
        <tr>
            <th>Item</th
            ><th>Price</th>
        </tr>
        <?php 
        $groc_array = ["Toilet Paper" => 2.00, "Chips" => 1.00, "Shampoo" => 5.00]; 
            foreach($groc_array as $key => $value)
            {
                echo "<tr>
                <td>$key</td><td>$value</td>
                </tr>";
            }
        ?>
    </table>
</body>
</html>
<pre> <!DOCTYPE html> <html lang="en-US"> <head> <title>My Grocery List</title> <meta name="description" content="A table for a menu"> <meta name="author" content="Mark Silva"> <meta charset="utf-8"> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <h1>My Menu</h1> <table> <caption>Grocery</caption> <tr> <th>Item</th ><th>Price</th> </tr> <?php $groc_array = ["Toilet Paper" => 2.00, "Chips" => 1.00, "Shampoo" => 5.00]; foreach($groc_array as $key => $value) { echo "<tr> <td>$key</td><td>$value</td> </tr>"; } ?> </table> </body> </html> </pre>

-- Feb 24 In-Class Exercise
<!DOCTYPE html> <html>
 <head>
  <style>
   table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
   }
   </style>
 </head>
 <body>
  <table>
   <caption>Late Night Snack</caption>
   <tr> 
     <td>Item</td>
     <td>Price</td>
   </tr>
   <?php
     $grocery_items = [
     "Milk" => 6.15
     "Cake" => 5.45
     "Cookies" => 4.25 ];
     
     foreach($grocery_items as $key => $value{
       echo"<tr><td>$key</td><td>$$value</td></tr>";
     }
   ?>
  </table>
 </body>
</html>
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <table> <caption>Late Night Snack</caption> <tr> <td>Item</td> <td>Price</td> </tr> <?php $grocery_items = [ "Milk" => 6.15 "Cake" => 5.45 "Cookies" => 4.25 ]; foreach($grocery_items as $key => $value{ echo"<tr><td>$key</td><td>$$value</td></tr>"; } ?> </table> </body> </html>

-- Feb 24 In-Class Exercise
<!doctype html> <html> <body>
    <?php
    $grocery = ["chicken", "beef", "lamb"];
	$length = count($grocery);
    
    for ($i = 0; $i < $length; $i++){
        echo $grocery[$i], "," . "\n";
    }
    ?>
 </body>   
</html>
<!doctype html> <html> <body> <?php $grocery = ["chicken", "beef", "lamb"]; $length = count($grocery); for ($i = 0; $i < $length; $i++){ echo $grocery[$i], "," . "\n"; } ?> </body> </html>

-- Feb 24 In-Class Exercise
<!DOCTYPE html>
 <html>
 <head>
 <style>
 table, th, td {
    border: 1px solid black; 
    border-collapse: collapse;
 }
 </style>
 </head>
 <body>
 <h2>Grocery List</h2>
 <?php
 $grocerylist = ["Tomato" => 3, "Potato" => 4, "Egg" => 5];
 ?>
 <table>
 <caption>Grocery List</caption>
 <tr><th>Item</th><th>Price</th></tr>
 <?php
 foreach($grocerylist as $key => $value) {
    echo "<tr><td>$key</td><td>$value</td></tr>";
 }
 ?>
 </table>
 </body>
 </html>
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <h2>Grocery List</h2> <?php $grocerylist = ["Tomato" => 3, "Potato" => 4, "Egg" => 5]; ?> <table> <caption>Grocery List</caption> <tr><th>Item</th><th>Price</th></tr> <?php foreach($grocerylist as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>"; } ?> </table> </body> </html>

-- Feb 24 In-Class Exercise
<!DOCTYPE html> 
 
<html> 
 
	<head>
		<title>Grocery List</title>
		<style>
			table, tr, th, td {
				border: 1px solid black;
				border-collapse: collapse;
			}
		</style>
	</head> 
 
	<body>
	<caption>Grocery List</caption>
	<table>
		<tr> 
			<th>Item</th>
            <th>Price</th>         </tr>   
		<?php 
        $grocery_list = [             "eggs" => 5.00,             "milk" => 3.00,             "bread" => 10.00         ];            foreach($grocery_list as $key => $value) {             echo "<tr><td>$key</td><td>$value</td></tr>";         }          ?>   
	</table> 
 
	</body>
</html>
<pre> <!DOCTYPE html> <html> <head> <title>Grocery List</title> <style> table, tr, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <caption>Grocery List</caption> <table> <tr> <th>Item</th> <th>Price</th> </tr> <?php $grocery_list = [ "eggs" => 5.00, "milk" => 3.00, "bread" => 10.00 ]; foreach($grocery_list as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>"; } ?> </table> </body> </html> </pre>

-- Feb 24 In-Class Exercise
<!DOCTYPE html> <html> <head> <title>Grocery List</title> </head> <body> <h3>Grocery List</h3> <table>
    <tr>
        <th>Item</th>
        <th>Cost</th>
    </tr>
<?php
    $grocery_items = [
        "Milk" => 2.49,
        "Salad" => 2.18,
        "Ketchup" => 3.99
    ];
    foreach($grocery_items as $item => $value) {
        echo "<tr>";
        echo "<td>". $item ."</td>";
        echo "<td>$". $value ."</td>";
        echo "</tr>";
    }
?> </table> </body> </html>
<!DOCTYPE html> <html> <head> <title>Grocery List</title> </head> <body> <h3>Grocery List</h3> <table> <tr> <th>Item</th> <th>Cost</th> </tr> <?php $grocery_items = [ "Milk" => 2.49, "Salad" => 2.18, "Ketchup" => 3.99 ]; foreach($grocery_items as $item => $value) { echo "<tr>"; echo "<td>". $item ."</td>"; echo "<td>$". $value ."</td>"; echo "</tr>"; } ?> </table> </body> </html>

-- Feb 24 In-Class Exercise
Grocery List Item Price
<nowiki> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Grocery List</title> </head> <body> <?php $assoc_arr = ["Milk" => "3.99", "Eggs" => "2.99", "Hot Dog" => "4.99"]; ?> <table> <tr> <th>Item</th> <th>Price</th> </tr> <?php foreach($assoc_arr as $item => $price) { echo "<tr><td>"; echo "$item"; echo "</td><td>"; echo "$$price"; echo "</td></tr>"; }; ?> </table> </body> </html> </nowiki>

-- Feb 24 In-Class Exercise
<!DOCTYPE html>
<html>
<head>
</head>
<body>
	<table>
		<caption>groceries</caption>
		<tr><th>item</th><th>price</th></tr>
		<?php
			$a = ["eggs" => 2.99, "apples" => 3.99, "bananas" => 1.99];
			foreach ($a as $item => $price) {
				echo "<tr><td>$item</td><td>$price</td></tr>";
			}
		?>
	</table>
</body> </html> (Edited: 2021-02-24)
<pre> <!DOCTYPE html> <html> <head> </head> <body> <table> <caption>groceries</caption> <tr><th>item</th><th>price</th></tr> <?php $a = ["eggs" => 2.99, "apples" => 3.99, "bananas" => 1.99]; foreach ($a as $item => $price) { echo "<tr><td>$item</td><td>$price</td></tr>"; } ?> </table> </body> </html> </pre>

-- Feb 24 In-Class Exercise
<!DOCTYPE html> <html>
	<head>
		<title>Grocery List</title>
	</head>
	<body>
		<h3>Grocery List</h3>
		<table>
		    <tr>
		        <th>Item</th>
		        <th>Price</th>
		    </tr>
			<?php
			    $item_price = [
			        "Shrimp" => 7.49,
			        "Cheese" => 6.99,
			        "Spam" => 4.99
			    ];
			    foreach($item_price as $item => $price) {
			        echo "<tr>";
			        echo "<td>". $item ."</td>";
			        echo "<td>$". $price ."</td>";
			        echo "</tr>";
			    }
			?>
		</table>
	</body>
</html>
<!DOCTYPE html> <html> <head> <title>Grocery List</title> </head> <body> <h3>Grocery List</h3> <table> <tr> <th>Item</th> <th>Price</th> </tr> <?php $item_price = [ "Shrimp" => 7.49, "Cheese" => 6.99, "Spam" => 4.99 ]; foreach($item_price as $item => $price) { echo "<tr>"; echo "<td>". $item ."</td>"; echo "<td>$". $price ."</td>"; echo "</tr>"; } ?> </table> </body> </html>

-- Feb 24 In-Class Exercise
<pre><!DOCTYPE html> <html> <head> <title>Grocery List</title> </head> <body> <h3>Grocery List</h3> <?php
$Fruit_items = [
    "Banana" => 3.99,
    "Mango" => 4.49,
    "Apple" => 6.99
];
?> <table>
    <tr>
        <th>Item</th>
        <th>Price</th>
    </tr>
    <?php
    foreach($Fruit_items as $item => $value) {
        echo "<tr>";
        echo "<td>". $item ."</td>";
        echo "<td>$". $value ."</td>";
        echo "</tr>";
    }
?> </table> </body> </html> Resource Description for Screen Shot 2021-02-24 at 4.47.41 PM.png
<pre><!DOCTYPE html> <html> <head> <title>Grocery List</title> </head> <body> <h3>Grocery List</h3> <?php $Fruit_items = [ "Banana" => 3.99, "Mango" => 4.49, "Apple" => 6.99 ]; ?> <table> <tr> <th>Item</th> <th>Price</th> </tr> <?php foreach($Fruit_items as $item => $value) { echo "<tr>"; echo "<td>". $item ."</td>"; echo "<td>$". $value ."</td>"; echo "</tr>"; } ?> </table> </body> </html> ((resource:Screen Shot 2021-02-24 at 4.47.41 PM.png|Resource Description for Screen Shot 2021-02-24 at 4.47.41 PM.png))
[ Next ]
X