Jump to content

Recommended Posts

I am so confused I have to get this  function to display in a table and I really dont know how, I have tryed this so many times and just dont get it. HELP!

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

        <title>Teas of the World!</title>

    </head>

    <body>

      <?php // Script 10.6 - Teas of the World.php

      // This function displays a four cell table.

      function tea($types) {

     

      $types = array ("Chinese Green", "Japanese Red", "Korean Black", "British White");

 

      echo "<table border=1 cellpadding=1 cellspacing=1><tr>";

      for ($cell = 0; $cell < 4; $cell++) { // Displays the cell count.

      echo "<td>".$types[$cell]."</td>";

      }

 

      }

     

      "</tr></table>";

?>

    </body>

</html>

try

 

$types = array ("Chinese Green", "Japanese Red", "Korean Black", "British White");
function tea($types) {
  ?>
  <table border="1"  cellpadding="1" cellspacing=1>
    <tr>
    <?PHP
    $cell=0;
    while($cell<4) {
       echo "<td>" . $types[$cell]. "</td>";
    }
    echo "</tr></table>";
}
tea($types);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.