Jump to content

pamelaanne

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by pamelaanne

  1. I'm doing this activity where a user chooses a base timezone and when the user clicks convert the current time in the selected GMT will be converted to GMT-11 to GMT+13. As of now, I have these codes: act09_view.php: <?php session_start(); $s="GMT "; echo "Select the base time zone:</br>"; for($n=-11;$n<=13;$n++) { if ($n>=0) $s="GMT +"; $gmt[]=$s . $n . "</br>"; } echo "<select name='gmt'>"; foreach ($gmt as $value) { echo '<option value="' . $value . '">' . $value . '</option>\n'; } echo '</select>'; //$_SESSION['value']=$value; ?> <form action="act09_process.php"> </br><input type='submit' value='Convert'/> </form> act09_process.php: <?php session_start(); //$value=$_SESSION['value']; //echo $value; date_default_timezone_set('Asia/Manila'); $gmttime=date('M j, Y g:i:s A'); echo "The current date and time at" . " is " . $gmttime; ?> I've tried using session variables. I think I executed them incorrectly. The output is supposed to look like this:
  2. OMG! I am this happy -> :D THANK YOU SO MUCH noXstyle, Psycho, and PFMaBiSmAd for all the help and explanations. THANK YOU.. VERY MUCH. :'(
  3. I have this other code.. Still, can't get the output right.. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php $sushi = array( 'Fresh Tuna Sushi' => array ( 'Fresh Tuna Fillet' => '8 ounces', 'Sushi Rice' => '2 cups', 'Wasabi Paste' => '2 tablespoons' ), 'Shrimp Sushi' => array ( 'Large Shrimps' => '10 pieces', 'Vinegar' => '2 tablespoons', 'Sushi Rice' => '2 cups', 'Wasabi Paste' => '2 tablespoons', ), 'Nori Crab Sushi' => array ( 'Nori Seaweeds' => '4 sheets', 'Crabmeat' => '8 ounces', 'Cream Cheese' => '8 ounces', 'Worcestershire Sauce' => '3/4 teaspoon', 'Garlic Salt' => '1/4 teaspoon' ), 'Vegetarian Sushi' => array ( 'Rice Vinegar' => '1/2 cup', 'Sesame Oil' => '2 tablespoons', 'Nori Seaweeds' => '4 sheets', 'Sushi Rice' => '2 cups', 'Cucumber Strips' => '1 cup', 'Sweet Potatoes' => '1 cup', 'Sesame Seeds' => '2 tablespoon' ), 'California Roll Sushi' => array ( 'Sushi Rice' => '1 cup', 'Nori Seaweeds' => '8 sheets', 'Sesame Seeds' => '2 tablespoons', 'Crabmeat' => '1/2 cup', 'Mayonnaise' => '3 tablespoons', 'Avocado' => '1 piece', 'Cucumber Strips' => '1/2 cup' ) ); /* foreach($sushi as $type => $value){ //faster than for loop foreach($value as $ingredients => $measurement){ echo '<br/>' . $type . '-' . $ingredients . '=>' . $measurement . '</br>'; } }*/ ?> <table border="1"> <tr> <th>Sushi</th> <th colspan="2">Ingredients</th> </tr> <?php foreach ($sushi as $type => $ingredients){ ?> <tr> <td rowspan="<?php echo count($sushi[$ingredients]) + 1; ?>" colspan="2"> <?php echo $type; ?> </td> <td><?php foreach ($ingredients as $name => $meas){ echo $name . '</br>'; } ?></td> <td><?php foreach ($ingredients as $name => $meas){ echo $meas . '</br>'; } ?></td> </tr> <?php } ?> </table> </body> </html>
  4. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <?php $sushi = array( 'Fresh Tuna Sushi' => array ( 'Fresh Tuna Fillet' => '8 ounces', 'Sushi Rice' => '2 cups', 'Wasabi Paste' => '2 tablespoons' ), 'Shrimp Sushi' => array ( 'Large Shrimps' => '10 pieces', 'Vinegar' => '2 tablespoons', 'Sushi Rice' => '2 cups', 'Wasabi Paste' => '2 tablespoons', ), 'Nori Crab Sushi' => array ( 'Nori Seaweeds' => '4 sheets', 'Crabmeat' => '8 ounces', 'Cream Cheese' => '8 ounces', 'Worcestershire Sauce' => '3/4 teaspoon', 'Garlic Salt' => '1/4 teaspoon' ), 'Vegetarian Sushi' => array ( 'Rice Vinegar' => '1/2 cup', 'Sesame Oil' => '2 tablespoons', 'Nori Seaweeds' => '4 sheets', 'Sushi Rice' => '2 cups', 'Cucumber Strips' => '1 cup', 'Sweet Potatoes' => '1 cup', 'Sesame Seeds' => '2 tablespoon' ), 'California Roll Sushi' => array ( 'Sushi Rice' => '1 cup', 'Nori Seaweeds' => '8 sheets', 'Sesame Seeds' => '2 tablespoons', 'Crabmeat' => '1/2 cup', 'Mayonnaise' => '3 tablespoons', 'Avocado' => '1 piece', 'Cucumber Strips' => '1/2 cup' ) ); /* foreach($sushi as $type => $value){ //faster than for loop foreach($value as $ingredients => $measurement){ echo '<br/>' . $type . '-' . $ingredients . '=>' . $measurement . '</br>'; } }*/ ?> <table border="1"> <tr> <th>Sushi</th> <th colspan="2">Ingredients</th> </tr> <?php foreach ($sushi as $type => $ingredients){ ?> <tr> <td rowspan="<?php echo count($sushi[$ingredients]) + 1; ?>"> <?php echo $type; ?> </td> <?php foreach ($ingredients as $name => $meas){ ?> <td><?php echo $name;?></td> <td><?php echo $meas;?></td> <?php } ?> </tr> <?php } ?> </table> </body> </html> So here's mhy code in PHP. I'm trying to create a table from an array but I just can't.........get.........it..........right! The output's supposed to look like this: Please help Any help would be graeatly appreciated. Thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.