无论我是否输入错误 ID 的值..在这两种情况下,php 标记之间的代码都会显示为输出。有人可以帮我找出原因。代码如下:
html文件------------------------------------------------ -------------
<!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>Bug Report</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<h2>Bug Report</h2>
<form action="test.php" method="post" >
<p>Bug ID:<input type="text" name="bugid" size="20" /></p>
<p><input type="submit" value="Record Bug" /></p>
</form>
</body>
</html>
php文件------------------------------------------------ --
<!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>Record Bug</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
$bugid=$_POST["bugid"];
echo $bugid;
if (empty($bugid))
{
echo "<p>You must enter the Bug ID to record the bug.</p>";
}
else
{
echo"<p>good</p>";
}
?>
</body>
</html>