我在 first_name 和 last_name 列下有一个名为 Harry Butler 的数据库,其中包含以下代码:
<?PHP
//Create the connection…
//("where the database is", 'Database login' , 'database password' , "Database name")
$con=mysqli_connect("", 'root', 'root', "Social");
//Check our connection…
if (mysqli_connect_errno($con))
{
echo " Sorry Mate";
}
$fname = $_POST[fname];
$lname = $_POST[lname];
$result = mysqli_query($con, "SELECT * FROM `User_info` WHERE first_name = '$fname' AND last_name = '$lname'");
while($row = mysqli_fetch_array($result))
{
echo $row['first_name'];
}
?>
从上一页获取表单数据:
<form action="searching.php" method="post">
<input id="fname" align="center" placeholder="First Name" name="fname"></input>
<input id="lname" align="center" placeholder="Last Name" name="lname"></input>
<select id="gender">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
<option value="God">God</option>
</select>
<br />
</form>
然而,当提交结果时,我一无所获?