<?
if($ok){
while(list($key,$val)=each($hehe))
   echo "$val<br>";
}
?>
<form action="" method=post>
<input type=checkbox name=hehe[]>csdn<br>
<input type=checkbox name=hehe[]>sina<br>
<input type=checkbox name=hehe[]>sohu<br>
<input type=submit name=ok>
</form>代码没有测试,可能有错~!
呵呵~!

解决方案 »

  1.   

    <?
    if($ok){
    while(list($key,$val)=each($hehe))
      echo "$val<br>";
    }
    return;
    ?>
    <form action="" method=post>
    <input type=checkbox name=hehe[]>csdn<br>
    <input type=checkbox name=hehe[]>sina<br>
    <input type=checkbox name=hehe[]>sohu<br>
    <input type=submit name=ok>
    </form>这个应该正确~!
      

  2.   

    <form action="" method=post>
    <input type=checkbox name=hehe[]>csdn<br>
    <input type=checkbox name=hehe[]>sina<br>
    <input type=checkbox name=hehe[]>sohu<br>
    <input type=submit name=ok>
    </form>
    以上正确,在后台取hehe[0],hehe[1],hehe[2]的值即可
      

  3.   

    如果有一大串复选框,例如hehe1  ,hehe2 ....hehe50;
    想每个数组都变成一个字符串;
      如hehe1[0]==a;hehe1[1]==b;hehe2[1]==b;hehe2[2]==c;
    .....
    hehe50[0]==a;hehe50[1]==b;如何令$hehe1==ab;$hehe2==bc
    .....
    $hehe50==ab;
    ///不用连续join()50次吧!
      

  4.   

    <form action="" method=post>
    <input type=checkbox name=hehe[]>csdn<br>
    <input type=checkbox name=hehe[]>sina<br>
    <input type=checkbox name=hehe[]>sohu<br>
    <input type=submit name=ok>
    </form>
    以上正确,在后台取hehe[0],hehe[1],hehe[2]的值即可 
    回复人: scxy(小熊) (2001-11-17 13:39:11) 
    小熊,你是真懂假懂呀?别在这里混着骗人了,你那是什么逻辑呀???!!
    笑死我了~~
    真笨!
      

  5.   

    回复人: soniclee(封寒月) (2001-11-17 6:48:02)  得0分 
    <?
    if($ok){
    while(list($key,$val)=each($hehe))
      echo "$val<br>";
    }
    ?>
    <form action="" method=post>
    <input type=checkbox name=hehe[]>csdn<br>
    <input type=checkbox name=hehe[]>sina<br>
    <input type=checkbox name=hehe[]>sohu<br>
    <input type=submit name=ok>
    </form>代码没有测试,可能有错~!
    呵呵~!
    ——————————————————————————————————————
    你是真懂假懂呀?别在这里混着骗人了,你那是什么逻辑呀???!!
    笑死我了~~
    真笨!
      
     
      

  6.   

    判断表单变量值要用value!!!!不是用name!!!!
    所以name要一个,value可以很多个~~
    这样才能做出复选框~~
    哎?
    我对中国软件业越来越有信心了~~~~~
    因为还有很多人在滥竽充数~~
    呵呵~~
      

  7.   

    橙子鸟,你可能错了。我记得php提供这样的功能的。
    不要太早下结论,自己动手试一下。
      

  8.   

    同样名字的复选框成为一个数组,如果没有设定value的话,默认为checked或unchecked。
      

  9.   

    0
    file:///E:/delphi/try.htm?ok=ok
    1
    file:///E:/delphi/try.htm?hehe=on&ok=ok
    12
    file:///E:/delphi/try.htm?hehe=on&hehe=on&ok=ok
    123
    file:///E:/delphi/try.htm?hehe=on&hehe=on&hehe=on&ok=ok
    13
    file:///E:/delphi/try.htm?hehe=on&hehe=on&ok=ok
    3
    file:///E:/delphi/try.htm?hehe=on&ok=ok唉,太长时间没用php了,橙子鸟是对的。
    5555555555555555
    能看懂上面的结果,就知道我说的是什么意思了。
    把form改成如下:
    <form action="">
    <input type=checkbox name=hehe>csdn<br>
    <input type=checkbox name=hehe>sina<br>
    <input type=checkbox name=hehe>sohu<br>
    <input type=submit name=ok value="ok">
    </form>
      

  10.   

    hehe  这也不好使呀!详细点可以吗!@@@@@ 谢谢大家了
      

  11.   

    没人回复了吗...
     CSDN的同人们..   救救我可以吗...
      

  12.   

    如果照上面那个例子改正的话<form action="">
    <input type=checkbox name=hehe value=csdn>csdn<br>
    <input type=checkbox name=hehe value=sina>sina<br>
    <input type=checkbox name=hehe value=sohu>sohu<br>
    <input type=submit name=ok value="ok">
    </form>这个仅仅是让你看看具体过程
    实际上可以是<form action="">
    <input type=checkbox name=hehe[0] value=csdn>csdn<br>
    <input type=checkbox name=hehe[1] value=sina>sina<br>
    <input type=checkbox name=hehe[2] value=sohu>sohu<br>
    <input type=submit name=ok value="ok">
    </form>接收那头用循环挨个收就是了
      

  13.   

    把checkbox的name命名成checkbox.$id,checkbox的value设成要插入得值,这样插入数据库比较方便了。多个值之间用特定符号隔开就是了。
    比如$sql = mysql_query("select id from tablenames");
    while($row = mysql_fetch_array($sql)){
        if(${checkbox.$row[id]}){
            //在这插入数据库
        }
    }
      

  14.   

    RE:c_crazyren(楚狂人)这位仁兄你的做法不对吧。。  没有INSERT 怎么插入呢。。有谁还有别的方法可以告诉我呢。。谢谢大家了。。
      

  15.   

    呵呵,还是我最有办法了,先建一个数据表multiple,假设在数据库test中
    create table multiple(name char(8),number int);
    再插入初始值
    insert into multiple values("php",0);
    insert into multiple valuse("asp",0);
    insert into multiple valuse("jsp",0);源程序如下:
    <? 
    if(isset($lan)) 

    ?>  
    <html>  
    <head><title>处理多项选择框一例</title></head>  
    <body>  
    <?
      $db=mysql_connect("localhost","","");
      if($db==false){
          print "对不起,现在无法链接数据库,请稍后再试。";
          }
      $res=mysql_select_db("test",$db);
      if($res==false){
          print "对不起,现在无法链接数据库,请稍后再试。";
          }
      
      for($i=0;$i<count($lan);$i++){
            $query="select number from multiple where name='$lan[$i]';";
            $res=mysql_query($query,$db);
            if($res==false){ print "无法查询";}
            $row=mysql_fetch_row($res);
            if($row==false){
               print "id $id doesn't exist.";
               exit();
          }
          $counter=$row[0]+1;
          $query="update multiple set number=$counter where name='$lan[$i]';";
          $res=mysql_query($query,$db);
          if($res==false){
           print"update failed!";
           exit();
        }}
        mysql_close($db);
    ?>
    </body>  
    </html>  
    <? 

    else 

    ?>  
    <html>  
    <head><title>处理多项选择框一例</title></head>  
    <body>  
    <form name="form1" method="post" action=""> 
    <p>  
    <input type="checkbox" name="lan[]" value="php"> 
    PHP<br> 
    <input type="checkbox" name="lan[]" value="asp"> 
    ASP<br> 
    <input type="checkbox" name="lan[]" value="jsp"> 
    JSP</p> 
    <input type="submit" value="完成"> 
    </form> 
    </body>  
    </html>  <? 
    }
    ?> 
      

  16.   

    请问题作者把你的库结构和要处理的复选框列出来!
    我想做php的人人都会.
    这样你可以选择一个适合你的.
      

  17.   

    你不干脆要别人写好给你好了,晕,还告诉我要insert,
    puke................