我正在开发这个需要发送特定报告的 Web 应用程序。然而,该报告是动态的,并且是表格格式。我现在希望做的事情是通过电子邮件将整个表通过电子邮件发送给某人。有什么办法可以做到吗?
脚本
<?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 "<table border='5' align=center>
<tr>
<th>ID</th>
<th>Type</th>
<th>Setting</th>
<th>Value</th>
<th>Actual</th>
</tr>";
while($row = mysql_fetch_array($query))
{
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['Type'] . "</td>";
echo "<td>" . $row['Setting'] . "</td>";
echo "<td>" . $row['Value'] . "</td>";
echo "<td>" . $row['Actual'] . "</td>";
echo "</tr>";
if($row['Value'] != $row['Actual'])
{
echo "<td bgcolor='#FD2911'>" . "X" . "</td>";
}
else
{
echo "<td bgcolor='#1CDC15'>" . "O" . "</td>";
}
}
echo "<br>";
mysql_close($con);
?>
html代码
<form action="query1.php" method="POST">
Enter the choice: <input type="varchar" name="id" /><br />
<input type="submit" value="Audit" />
</form>