Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在html中使用数据库表列的复选框?_Php_Html_Mysql_Sql Server_Wamp - Fatal编程技术网

Php 如何在html中使用数据库表列的复选框?

Php 如何在html中使用数据库表列的复选框?,php,html,mysql,sql-server,wamp,Php,Html,Mysql,Sql Server,Wamp,差不多是头衔。我是html新手,只想知道如何过滤出数据库表中的列。以下是我得到的: <?php $link=@mysql_connect('localhost','root',''); mysql_select_db("home_work"); $sql="SELECT * FROM employee "; $aResult=mysql_query($sql); ?> <html> <body bgcolor="Orange"> <H1> <

差不多是头衔。我是html新手,只想知道如何过滤出数据库表中的列。以下是我得到的:

<?php
$link=@mysql_connect('localhost','root','');
mysql_select_db("home_work");
$sql="SELECT * FROM employee ";
$aResult=mysql_query($sql);

?>
<html>
<body bgcolor="Orange">
<H1>
<center>
<?php
echo '<p>Testing SQL table</p>' ; 
?></p>
</center>
</H1>



<form action="columnChecks.php">
  <input type="checkbox" name="columna" value="a1"> Column 1<br>
  <input type="checkbox" name="columna" value="a2" > Column 2<br>
  <input type="submit" value="Submit">
</form>



<form name="frmForm" id="frmForm" >
<table border="1" width="30%" height="30%"> 
<tr>
<th><font color='Purple'>ID</font></th>
<th><font color='Purple'>NAME</font></th>
<th><font color='Purple'>ADDRESS</font></th>
<th><font color='Purple'>DESIGNATION</font></th>
<th><font color='Purple'>SALARY</font></th>
</tr> 

<?php

while($rows = mysql_fetch_array($aResult,MYSQL_ASSOC))
{ 
$id           = $rows['id'];
$empid        = $rows['empid'];
$empname      = $rows['empname'];
$empaddress   = $rows['empaddress'];
$designation  = $rows['designation'];
$salary       = $rows['salary']; 
?>
<tr>

<td><b><font color='#663300'><?php echo $empid;?></font></b></td>
<td><b><font color='#663300'><?php echo $empname;?></font></b></td>
<td><b><font color='#663300'><?php echo $empaddress;?></font></b></td>
<td><b><font color='#663300'><?php echo $designation;?></font></b></td>
<td><b><font color='#663300'><?php echo $salary;?></font></b></td>

</td>
</tr>

<?php } ?>
</table>
</form>
</body>
</html>

第1列
第2列
身份证件 名称 地址 任命 薪水
因此,我试图让用户检查他/她想要显示的任何列,然后只使用这些列创建一个表

第一个问题:有没有办法不使用“第1栏”和“第2栏”,而是将该栏的名称拔出,然后在“第1栏”和“第2栏”的位置插入相应的栏名

只要我点击任何一个按钮,它就会给我一个空白页(可能是因为我没有columnChecks.php文档。我该如何处理提交表单的输出?我知道action属性是columnChecks.php,这就是问题所在,问题是我不知道从哪里开始…

这将帮助您:

此时HTML+PHP还不足以实现您的目标(至少不容易),您需要从JavaScript获得一些帮助

祝你好运,玩得开心!

这将帮助你:

此时HTML+PHP还不足以实现您的目标(至少不容易),您需要从JavaScript获得一些帮助

祝你好运,玩得开心