我有在db中搜索的表格。当我打开搜索页面时,我收到以下消息: 注意:第90行的D:\ xampp \ htdocs \ zdrave \ search.php中的未定义索引:element_1
注意:未定义的索引:第90行的D:\ xampp \ htdocs \ zdrave \ search.php中的element_2
注意:未定义的索引:第90行的D:\ xampp \ htdocs \ zdrave \ search.php中的element_3 我该如何纠正?
<?php
$con=mysqli_connect("localhost","root","","expences");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT inv_num, inv_date, inv_desc, inv_amnt FROM invoices WHERE inv_num = '$_POST[element_1]' or inv_date = '$_POST[element_2]' or inv_desc like '$_POST[element_3]' ");
echo "<table border='1'>
<tr>
<th>Фактура</th>
<th>Дата</th>
<th>Описание</th>
<th>Стойност</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['inv_num'] . "</td>";
echo "<td>" . $row['inv_date'] . "</td>";
echo "<td>" . $row['inv_desc'] . "</td>";
echo "<td>" . $row['inv_amnt'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>