-5 html php mysql phpmyadmin
我写了一个PHP代码.我无法从数据库中检索结果.在提交它juz给出一个空白页面widout抛出任何错误.我是新手,所以即使你认为这是一个愚蠢的问题,请回复.请参阅代码并向我建议一些将使我的代码工作的更改.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<title>EDIT SCREEN</title>
<form action="test4.php" method="post">
<ul>
<li>
Employee ID:</br>
<input type="text" name="eid">
</li>
<li>
<input type="submit" value="SUBMIT">
</li>
</ul>
</form>
</body>
</html>
//test4.php file
$value1 = $_POST['eid'];
$res = $mysql_query(SELECT * from `add` WHERE empid = `$value1`);
echo "<table border='1'>
<tr><th>Name</th>
<th>EmployeeID</th><th>Address</th></tr>";
while($row = mysql_fetch_array($res))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['empid'] . "</td>";
echo "<td>" . $row['add'] . "</td>";
echo "</tr>";
}
echo "</table>";Run Code Online (Sandbox Code Playgroud)
你有两个<form>标签:
<form> <---this is the one being used by the browser to submit
<form action="test3.php" method="post"> <--this will be ignored outright
Run Code Online (Sandbox Code Playgroud)
<form>没有属性的普通标签将被视为:
<form action="" method="get">
Run Code Online (Sandbox Code Playgroud)
并将简单地"提交"到表单页面加载的任何地址.