Skip to main content
Added a check for "isset"
Source Link
drew_w
  • 10.5k
  • 4
  • 32
  • 50

If what you have isn't working, try concatenating the value:

<?php
function show_html($num_found)
{
   // if you aren't sure if "num_found" is going to be set, add this:
   if (!isset($num_found)) $num_found = 0;

   // now set the html
   $html = "<html><head></head><body>
      <table width='100%' border='1'>
         <tr align='center'><th colspan='2'>ERROR REPORT</th></tr>
         <tr align='center'>
            <td>Number of error found</td>
            <td>".$num_found."</td>
         </tr>                               
      </table>
   </body></html>";

   return $html;
} 

// the num found variable needs to be defined somewhere...
$num_found = 10;

// after that the echo will work
echo show_html($num_found);
?>   

If what you have isn't working, try concatenating the value:

<?php
function show_html($num_found)
{
   $html = "<html><head></head><body>
      <table width='100%' border='1'>
         <tr align='center'><th colspan='2'>ERROR REPORT</th></tr>
         <tr align='center'>
            <td>Number of error found</td>
            <td>".$num_found."</td>
         </tr>                               
      </table>
   </body></html>";

   return $html;
}

echo show_html($num_found);
?>   

If what you have isn't working, try concatenating the value:

<?php
function show_html($num_found)
{
   // if you aren't sure if "num_found" is going to be set, add this:
   if (!isset($num_found)) $num_found = 0;

   // now set the html
   $html = "<html><head></head><body>
      <table width='100%' border='1'>
         <tr align='center'><th colspan='2'>ERROR REPORT</th></tr>
         <tr align='center'>
            <td>Number of error found</td>
            <td>".$num_found."</td>
         </tr>                               
      </table>
   </body></html>";

   return $html;
} 

// the num found variable needs to be defined somewhere...
$num_found = 10;

// after that the echo will work
echo show_html($num_found);
?>   
Source Link
drew_w
  • 10.5k
  • 4
  • 32
  • 50

If what you have isn't working, try concatenating the value:

<?php
function show_html($num_found)
{
   $html = "<html><head></head><body>
      <table width='100%' border='1'>
         <tr align='center'><th colspan='2'>ERROR REPORT</th></tr>
         <tr align='center'>
            <td>Number of error found</td>
            <td>".$num_found."</td>
         </tr>                               
      </table>
   </body></html>";

   return $html;
}

echo show_html($num_found);
?>