无论我在两种情况下是否输入bug id的值,php标记之间的代码都显示为输出。有人能帮我找出原因吗? 代码如下:将html表单值传递给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 file ------------------ --------------------------------
<!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>
你是说if和else条件都正在执行,还是你说实际的PHP代码出现在页面上? – j08691 2012-08-17 03:34:59
输出是:您必须输入Bug ID才能记录错误。 “;}其他{回声” 好 “;}?> – xing 2012-08-17 03:36:43
你的代码是广泛开放的sql-禁制令 – 2012-08-17 03:45:17