我上次查询需要帮助。当我提交时,我想显示该特定LRN的所有列。我无法让它发挥作用。当我点击提交时,它没有显示任何内容。提前谢谢。
<?php
$conn = new mysqli('localhost', 'root', 'user, 'pwd')
or die ('Cannot connect to db');
$result = $conn->query("select * from students");
echo "<html>";
echo "<body>";
echo "<form method = POST>";
echo "<select name = 'Students' onchange=this.form.submit()>";
while ($row = $result->fetch_assoc()) {
unset($LRN, $First, $Last);
$LRN = $row['LRN'];
$First = $row['First_Name'];
$Last = $row['Last_Name'];
echo '<option value="'.$LRN.'">'.$Last.', '.$First.'</option>';
}
echo "</select>";
echo "<input type='submit' name='submit' value='Show'>";
echo "</form>";
$submit = filter_input(INPUT_POST,'submit');
$students = filter_input(INPUT_POST,'Students');
if(isset($submit)) {
$tae = $conn->query('select * from students WHERE LRN=.$Students.');
echo $tae;
}
echo "</body>";
echo "</html>";
?>