我正在尝试通过此单选按钮回显或打印查询结果:
<input type="radio" name="Query" value="SELECT employees.name FROM employees, department WHERE employees.department_deptID=department.deptID AND department.departName="Information Technology""> List all employees in a particular department (Information Technology).<br />
我目前使用的代码是这样的:
if ($_POST['submit'] == "submit" && isset($_POST['Query'])){
$query = $_POST['Query'];
$result = mysql_query($query);
print $query;
while($row = mysql_fetch_assoc($result)){
foreach($row as $cname => $cvalue){
print "$cname: $cvalue\t";
}
print "\r\n";
}
}
除了一些其他单选按钮,我还有一个提交按钮来启动操作:
<input type="submit" name="submit" value="submit">
提前感谢您的帮助。