在单击表单时,转移到另一个PHP页面,并显示复选框的结果
On clicking the form divert to another PHP page with the results of the check box
我在一个页面上有一组复选框,提交按钮value="compare"不在表单中。我已经为表单外部的按钮比较编写了一个jQuery。我正在并排比较一组表格。我的代码在同一个页面上工作得很好。我不知道如何在另一个页面中显示结果。谁来帮帮我。
<?php
require('db.php');
?>
<!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>Comparision</title>
</head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#compare_id").click( function(){
$("input:checkbox:not(:checked)").each(function() {
var column = "table ." + $(this).attr("name");
$(column).hide();
});
});
});
$(document).ready(function(){
$("#compare_id").click( function(){
$("input:checkbox:(:checked)").each(function(){
var column = "table ." + $(this).attr("name");
$(column).toggle();
});
});
});
</script>
</head>
<body>
<input name="compare" id="compare_id" type="button" value="Compare" />
<form action="test.php" method="post" name="printers_comparision">
<p>
<label>
<input type="checkbox" name="p1" value="Printer1" id="CheckboxGroup1_0" />
Printer1</label>
<label>
<input type="checkbox" name="p2" value="Printer2" id="CheckboxGroup1_1" />
Printer2</label>
<label>
<input type="checkbox" name="p3" value="Printer3" id="CheckboxGroup1_2" />
Printer3</label>
<label>
<input type="checkbox" name="p4" value="Pritner4" id="CheckboxGroup1_3" />
Printer4</label>
<label>
</form>
<table width="1023" border="1">
<tr>
<td width="193"></td>
<td class="p1" width="113"><img src="images/im.png"/></td>
<td class="p2" width="67"><img src="images/im.png"/></td>
<td class="p3" width="67"><img src="images/im.png"/></td>
<td class="p4" width="67"><img src="images/im.png"/></td>
</tr>
<tr>
<td>Title</td>
<td class="p1" >Printer1</td>
<td class="p2" >Printer2</td>
<td class="p3" >Printer3</td>
<td class="p4" >Printer4</td>
</tr>
<tr>
<td>Manufacturer</td>
<td class="p1" ><?php $query=mysql_query('select Manufacturer from printers where printers_id="1";');
while($row=mysql_fetch_array($query)) echo $row['Manufacturer'] ?></td>
<td class="p2" ><?php $query=mysql_query('select Manufacturer from printers where printers_id="2";');
while($row=mysql_fetch_array($query)) echo $row['Manufacturer'] ?></td>
<td class="p3" ><?php $query=mysql_query('select Manufacturer from printers where printers_id="3";');
while($row=mysql_fetch_array($query)) echo $row['Manufacturer'] ?></td>
<td class="p4" ><?php $query=mysql_query('select Manufacturer from printers where printers_id="4";');
while($row=mysql_fetch_array($query)) echo $row['Manufacturer'] ?></td>
</tr>
</body>
</table>
</table>
如果需要跨页面显示数据,可以尝试使用SESSION
变量或设置COOKIE
。
相关文章:
- AngularJs|Don'在成功加载所有指令htmls之前,不显示页面
- 如何仅在横向模式下显示页面
- 突出显示页面上嵌入的iframe中的单词
- 仅显示页面AngularJS上的特定选项卡
- 在显示页面之前使用 jquery ajax 加载图像和声音
- 显示页面一旦完全加载涡轮链接
- jQuery移动显示页面5秒钟,然后重定向
- 启用面板向左滚动时,如何在左侧部分显示页面
- Twitter引导选项卡显示页面加载时未触发事件
- Chart.js显示页面加载时的工具提示
- 当单击按钮时,隐藏已显示页面加载的段落
- 如何在后台加载图像,然后在完成后显示页面
- 如何让 JQuery 在显示页面之前交换图片
- 如何在页面完成加载之前显示页面加载 html 文件
- 在模式窗口中显示页面上单击的值(链接)以及索引值
- 在文本区域中显示页面行
- 在谷歌阿贾克斯中显示页面加载微调器
- 在页面之间显示“页面加载”消息
- 记录单击的链接,然后在框中显示页面名称作为历史记录
- 如何在表单域中显示页面标题