我现在已经让我的数据库提取了结果,但是它在 PHP 脚本页面 (test.php) 上提取了它们。我想在名为“DOB”和“电子邮件”的表单框中显示表单页面上的结果。
表单页面:
<form id="form_53" name="login" action="test.php">
<input type="text" name="username">
<input type="text" name="DOB">
<input type="text" name="email">
<input type="submit" style="position:absolute;>
</form>
PHP:
<?php
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$username = $_POST['username'];
echo '</br>';
$query = mysql_query("SELECT * FROM `members` WHERE `username`='$username'");
while($result = mysql_fetch_array($query)) {
//display
echo $result['DOB']; //I want this displayed on the 'DOB' form box
echo $result['email']; //I want this displayed on the 'email' form box
}
?>