title: store part of the page in variable
body: <p>i have a page contains a table and this table contains a lot of coding like this</p>
  
  <pre><code>&lt;table class="table"&gt;
            &lt;tbody&gt;
            &lt;tr &gt;
              &lt;td width="20" class="tabletop"&gt;م&lt;/td&gt;
              &lt;td class="tabletop" &gt;name&lt;/td&gt;
              &lt;td class="tabletop" style="width:120px"&gt;date&lt;/td&gt;
              &lt;td class="tabletop" style="width:120px"&gt;note1&lt;/td&gt;
  
               &lt;td class="tabletop" style="width:100px"&gt;note2&lt;/td&gt;
               &lt;td class="tabletop" style="width:90px"&gt;note3&lt;/td&gt;
  
            &lt;/tr&gt;
            &lt;? $res=mysql_query($sql);
                   while($resArr=mysql_fetch_array($res)){ ?&gt;
  
            &lt;tr style="width:700px"&gt;
              &lt;td  class="tabletext"&gt;&lt;?= ++$serial;?&gt;&lt;/td&gt;
              &lt;td class="tabletext" &gt;&lt;?= $resArr[stName];?&gt;&lt;/td&gt;
               &lt;td class="tabletext"&gt;&lt;?= $resArr['date'];?&gt;&lt;/td&gt;
              &lt;td class="tabletext" &gt;&lt;?= $resArr[matName];?&gt;&lt;/td&gt;
  
              &lt;td class="tabletext" &gt;&lt;? if($resArr[exam]==1) echo "work";else echo "final";?&gt;&lt;/td&gt;
               &lt;td class="tabletext" &gt;&lt;? if($resArr[exam_type]==1) echo "prac";else echo "test";?&gt;&lt;/td&gt;
  
            &lt;/tr&gt;
  
            &lt;? }?&gt;
            &lt;/tbody&gt;
         &lt;/table&gt;
  </code></pre>
  
  <p>as you see the table has php coding 
  now i want to store the whole table in variable so i can send it to pdf printing library tcpdf</p>