我正在尝试使用PHP
将 HTML 表单数据传递给MYSQL
数据库并将数据返回给浏览器。通过提交检查权限 ( M1
, M2
,MN1
..),我想显示拥有这些权限的教师的姓名。现在,请告诉我代码有什么问题:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<form action="akcja.php" method="post">
<br /><br /><br />
<table>
<tr><th><br/><input type="checkbox" id="check" name="M1" value="M1,">m1</th>
<th><br/><center><input type="checkbox" id="check" name="M2" value="M2,">m2</center></th>
<th><br/><center><input type="checkbox" id="check" name="MN1" value="MN1,"> mn1 </center></th> </tr></table>
<input type="submit" name="submit" value="Search Database" />
</form>
</body>
</html>
<?php
$query = mysql_query("SELECT * FROM permissions WHERE m LIKE '".$_POST['M1']."' OR m LIKE '".$_POST['M2']."' OR mn LIKE '".$_POST['MN1']."' ");
if($query)
while($permissions = mysql_fetch_assoc($query)){
$query2 = mysql_query("SELECT name_surname FROM instruktorzy WHERE instruktor_id='".$permissions['instruktor_id']."'");
while($Mdwa = mysql_fetch_assoc($query2)){
echo "<p style=\"font-size: 14px; font-family: Helvetica; background-color: #FFFFFF\"> ".$Mdwa['name_surname']."<br />" ; "</p>" ;
}
}
?>