字体:  

选中某行进行操作???

sosql 发表于: 2007-8-15 16:07 来源: PHPChina 开源社区门户

选中checkbox,怎么传值?进行删除,修改了??

最新回复

sxm8271 at 2007-8-15 16:18:00
把ID值赋给checkbox,checkbox名称要用数组形式
sosql at 2007-8-15 16:29:12
<input type="checkbox" name="checkid" value="<?php echo $row[0]?>">
接下来,怎么判断选中了?选中怎么传值操作??
sxm8271 at 2007-8-15 16:36:55
那些按钮是提交的吧??
用print_r($_POST)查看
sosql at 2007-8-15 16:47:53
上面的都不是按钮是图片了?!
sxm8271 at 2007-8-15 16:53:10
那总的得有个提交的东西吧
sosql at 2007-8-15 16:54:59
没提交能否实现??或者说选中了,就相当于提交了!

[ 本帖最后由 sosql 于 2007-8-15 16:56 编辑 ]
sxm8271 at 2007-8-15 16:55:42
能,用JS脚本
sosql at 2007-8-15 17:02:59
那改怎么判断???
sxm8271 at 2007-8-15 17:12:28
如果选中的话就提交,那样只能一个一个来
sosql at 2007-8-15 17:50:57
当然一个一个来了,我还有修改了!
sxm8271 at 2007-8-15 17:59:23
那就写个JS,如果选中,就提交
sosql at 2007-8-16 09:11:02

QUOTE:

原帖由 sxm8271 于 2007-8-15 17:59 发表
那就写个JS,如果选中,就提交
那该怎么写了???js
sosql at 2007-8-16 17:42:48
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {color: #000080; font-family: "华文琥珀"; font-size: 36px;}
-->
</style>
<link href="../Css/web_twdesign_css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE4 {
        font-family: "黑体";
        font-weight: bold;
}
-->
</style>                  

</head>

<body>
<script>
        function form_submit()
        {
                if(document.form3.checkbox1.checked==true)
                {
                        document.form3.submit();
                }
        }
</script>


<?php
require_once('conn.php');

mysql_query('SET NAMES gbk');
  $query="select * from members order by ID desc";
  $result=mysql_query($query);




$id=$_POST["checkbox1"];


echo $id;
  

   
?>


<form method="post" name="form3" action=""><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" style="BORDER-RIGHT: #666666 1px solid"><table width="100%" border="0" cellspacing="0" cellpadding="4">
      
          <tr>
            <td colspan="2" align="center" bgcolor="#2A9FFF" class="STYLE3 STYLE4">后台管理系统</td>
          </tr>
          <tr height="1">
            <td width="55%" bgcolor="#666666"></td>
            <td width="45%" bgcolor="#666666"></td>
          </tr>
        
      </table></td>
  </tr>
  <tr>
    <td align="left" valign="top" style="BORDER-RIGHT: #666666 1px solid"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      
            <tr>
              <td height="25" align="left" bgcolor="#D1D1D1"><strong><a href="memberlist.php" target="_blank">会员列表</a></strong></td>
              <td align="left" bgcolor="#D1D1D1"><strong><a href="bloglist.php" target="_blank">博客管理</a></strong></td>
              <td align="left" bgcolor="#D1D1D1"><strong><a href="orders_list.php" target="_blank">网上订单</a></strong></td>
              <td align="left" bgcolor="#D1D1D1"><strong>行业信息</strong></td>
              <td align="left" bgcolor="#D1D1D1"><strong><a href="member_registe.php" target="_blank">添加会员</a></strong></td>
              <td width="16%" align="left" bgcolor="#D1D1D1"><strong>临时会员</strong></td>
            </tr>
            <tr>
              <td width="15%" height="24" align="left" bgcolor="#f7f7f7"><a href="member_registe.php" target="_blank"><img src="../imag/twdesign_0210.jpg" width="56" height="19" border="0"></a></td>
              <td width="19%" height="24" align="left" bgcolor="#f7f7f7"><a href="delete.php?id=<?php echo $id?>"><img src="../imag/twdesign_00002.jpg" width="56" height="19" border="0"></a></td>
              <td width="17%" height="24" align="left" bgcolor="#f7f7f7"><a href="update_member.php?fid=<?php echo $id?>"><img src="../imag/twdesign_00003.jpg" width="56" height="19" border="0"></a></td>
              <td width="15%" height="24" align="left" bgcolor="#f7f7f7"><img src="../imag/twdesign_00004.jpg" width="56" height="19"></td>
              <td height="24" align="left" bgcolor="#f7f7f7"><img src="../imag/twdesign_00005.jpg" width="56" height="19"></td>
                          <td><input name="Submit" type="submit" class="input-1" id="Submit" value="提交">
                          
                          </td>
              </tr>
      
        </table>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr bgcolor="#F7F7F7">
                    <td height="25" align="left" bgcolor="#EAEAEA"><table width="100%" cellspacing="1" bgcolor="#EAEAEA">
                      <tr>
                        <td width="5%" bgcolor="#FFFFFF">ID</td>
                        <td width="10%" bgcolor="#FFFFFF">姓名</td>
                        <td width="12%" bgcolor="#FFFFFF">用户名</td>
                        <td width="14%" bgcolor="#FFFFFF">密码</td>
                        <td width="23%" bgcolor="#FFFFFF">单位</td>
                        <td width="14%" bgcolor="#FFFFFF">电话</td>
                        <td width="11%" bgcolor="#FFFFFF">手机</td>
                        <td width="11%" bgcolor="#FFFFFF"> </td>
                      </tr><?php while($row=mysql_fetch_array($result))
                                {
                                  ?>
                      <tr>
                        <td height="22" bgcolor="#FFFFFF"><?php echo $row[0]?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[3]?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[1]?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[2]?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[11] ?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[6] ?></td>
                        <td bgcolor="#FFFFFF"><?php echo $row[8] ?></td>
                        <td bgcolor="#FFFFFF"><input type="checkbox" name="checkbox1" value="<?php echo $row[0]?>" onClick="form_submit()" ></td>
                      </tr>
                      <?php }?>
                    </table></td>
                  </tr>
                  <tr bgcolor="#F7F7F7">
                    <td height="25" bgcolor="#EAEAEA">                      </td>
                  </tr>
                </tbody>
            </table></td>
      </tr>
    </table></td>
  </tr>
</table></form>
</body>
</html>
grs7002 at 2007-8-16 17:47:07
<input type="checkbox" name="checkid[]" value="<?=$row[0]?>">

这样交给数组处理!!很好做!
cgwxyz at 2007-8-17 10:55:31
用javascript来做了, 被选中的会存放在一个数组里的