title: send dynamic table via email
body: <p>I am working on this web application that needs to send a certain report. The report is dynamic however and it is in a table format. The thing i hope to do now is to email the whole table via email to someone. Is there any way I can do so?</p>
  
  <p>php script</p>
  
  <pre><code>    &lt;?php
      $con = mysql_connect("localhost", "root", "");
      if (!$con) 
        {
        die('Could not connect: ' . mysql_error());
        }
  
      mysql_select_db("mydb", $con);
      $input = $_POST['id'];
      $query = mysql_query("SELECT * FROM table WHERE ID = '$input'");
  
      echo "&lt;table border='5' align=center&gt;
      &lt;tr&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;Type&lt;/th&gt;
      &lt;th&gt;Setting&lt;/th&gt;
      &lt;th&gt;Value&lt;/th&gt;
      &lt;th&gt;Actual&lt;/th&gt;
      &lt;/tr&gt;";
  
      while($row = mysql_fetch_array($query)) 
          { 
           echo "&lt;tr&gt;";
        echo "&lt;td&gt;" . $row['ID'] . "&lt;/td&gt;";
        echo "&lt;td&gt;" . $row['Type'] . "&lt;/td&gt;";
        echo "&lt;td&gt;" . $row['Setting'] . "&lt;/td&gt;";
        echo "&lt;td&gt;" . $row['Value'] . "&lt;/td&gt;";
        echo "&lt;td&gt;" . $row['Actual'] . "&lt;/td&gt;";
        echo "&lt;/tr&gt;"; 
  
              if($row['Value'] != $row['Actual']) 
                  { 
                  echo "&lt;td bgcolor='#FD2911'&gt;" . "X" . "&lt;/td&gt;";
                  } 
              else 
                  { 
                  echo "&lt;td bgcolor='#1CDC15'&gt;" . "O" . "&lt;/td&gt;";
                  } 
          }
      echo "&lt;br&gt;";
  
      mysql_close($con);
      ?&gt;
  </code></pre>
  
  <p>html code</p>
  
  <pre><code>    &lt;form action="query1.php" method="POST"&gt;
      Enter the choice: &lt;input type="varchar" name="id" /&gt;&lt;br /&gt;
      &lt;input type="submit" value="Audit" /&gt;
      &lt;/form&gt; 
  </code></pre>