title: Using Nested PHP For Loops to Display 2-D HTML Table, but PHP Cannot Be Used for the Actual Table Tags
body: <p>Thank you for taking the time to help.</p>
  <p>I'm working on an assignment for school, and I know this question seems similar to others on Stack, but it has a small change that makes all the difference.</p>
  <p>I need to create a simple PHP webpage that displays a table whose cells are filled with random numbers. Easy enough, however, I cannot use PHP to display any of the table tags. Originally I had this:</p>
  <pre><code>&lt;table id=&quot;tab1&quot;&gt;
  &lt;?php
  for ($row = 0; $row &lt;= 10; $row++) {
      echo &quot;&lt;tr&gt; \n&quot;;
      for ($col = 0; $col &lt; 10; $col++) {
          $r = rand(10,100);
          echo &quot;&lt;td&gt;$r&lt;/td&gt; \n&quot;;
      }
      echo &quot;&lt;/tr&gt;&quot;; 
    }
  ?&gt;
  &lt;/table&gt;
  </code></pre>
  <p>This works and has the functionality I need, but it uses PHP to display the table row and table cell tags, and the assignment instructions say not to. So I tried this:</p>
  <pre><code>&lt;table id=&quot;tab1&quot;&gt;
      &lt;?php
      for ($row = 0; $row &lt;= 10; $row++) {  
      ?&gt;
      &lt;tr&gt; 
          &lt;?php 
          for ($col = 0; $col &lt; 10; $col++) {
              $r = rand(10,100);   
          ?&gt;
          &lt;td&gt;
              &lt;?php$r?&gt;
          &lt;/td&gt;
          &lt;?php }?&gt;
          &lt;/tr&gt;
          &lt;?php}?&gt;
      &lt;/tr&gt;
  
  &lt;/table&gt;
  </code></pre>
  <p>But of course, it isn't working, so what am I missing? I'd appreciate any advice!</p>