我用的是复选框,但是我提交过来的时候总是只得到一个值,请大家帮帮忙啊
解决方案 »
- mysql自增字段的问题
- 急!!个人网站的需求分析该怎么写
- ZF中,_redirect()方法是否只能用在内容输出前?
- php move_uploaded_file 上传文件 问题
- 服务器上和本地测试不一样????
- 关于php的简单的cookie问题求助
- 怎么样在linux启动PHP?
- 计数器,投票系统中要用到的imagecreatefromgif()和imageline()是不是要装GD library
- 我在test111.php中给两个session赋了值,按道理说,应该可以在test222.php中读出来,可是去不行,为什么?谢谢!
- memcached 代码问题
- php 是什么?? 请教
- 简单运算为题
服务器端取得值为数组,就可以处理了.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
function selectAll()
{
for(var i=0;i<document.form1.del[].length;i++)
{
document.form1.del[][i].checked=false;
}
}
function unSelect()
{
for(var i=0;i<document.form1.del[].length;i++)
{
if(document.form1.del[][i].checked)
{
document.form1.del[][i].checked=false;
}
else
{
document.form1.del[][i].checked=true;
}
}
}
</script>
<body>
<form name="form1" method="post" action="delPost.php">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#FFFFFF">
<td width="96" height="25"><div align="center">用户名</div></td>
<td width="136" height="25"><div align="center">密码</div></td>
<td width="115"><div align="center">登陆时间</div></td>
<td width="148"><div align="center">
<input name="delete" type="submit" id="delete" value="删除">
<input type="button" name="Submit" value="全选" onclick="selectAll();">
<input type="button" name="Submit2" value="反选" onclick="unSelect();">
</div></td>
</tr>
<?php
require_once("mysql.php");
$sql="select * from admin";
$result=dbConn($sql);
while ($array=mysql_fetch_array($result["rs"])){
?>
<tr bgcolor="#FFFFFF">
<td height="25"><div align="center">
<?=$array["a_zhanghao"]?>
</div></td>
<td height="25"><div align="center">
<?=$array["a_mima"]?>
</div></td>
<td><div align="center">
<?=$array["login_time"]?>
</div></td>
<td><div align="center">
<input name="del[]" type="checkbox" id="del[]" value="<?php echo $array["a_id"]?>">
</div></td>
</tr>
<?php
}
?>
</table>
</form>
</body>
</html>
调用的地方缺少对象,是怎么会事啊?
<input type="checkbox" name="checkbox[1]" value="a">
<input type="checkbox" name="checkbox[2]" value="b">
<input type="checkbox" name="checkbox[3]" value="c">
<input type="submit">
</form>
程序
<?
if(!empty($_POST['checkbox']))
foreach($_POST['checkbox'] as $k=>$v){
echo $k.'='.$v.'<br>';
}
?>
将javascript改成以下试试
===============================
<script language="javascript">var sid = document.getElementsByName('del[]');function selectAll()
{ for(var i=0;i<sid.length;i++)
{
sid[i].checked=true;
}
}
function unSelect()
{
for(var i=0;i<sid.length;i++)
{
if(sid[i].checked)
{
sid[i].checked=false;
}
else
{
sid[i].checked=true;
}
}
}
</script>