我预计单击“提交”按钮会用两个回显语句覆盖 HTML 页面。但是,不会发生覆盖。该页面已连接到 Apache。
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if (!isset($_POST['submit']))
{
// if page is not submitted to itself echo the form
}
else {
echo("Hello, " . $_POST['username']);
echo("Your password is " . $_POST['password'] . "!");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Visual Debate Home</title>
</head>
<body>
<h1>Visual Debate</h1>
<form method="post" action="?">
<div>Username: </div><div><input type="text" name="username" size="20" maxlength="20"></div>
<div>Password: </div><input type="password" name="password" size="15" maxlength="15"></div>
<div><input type="submit" value="submit" name="submit"></div>
</form>
</body>
</html>