用php作循环呗
例子如下:<form action="",method="post">
<? for($a=1;%a<=50;%a++):
 $b=bc;
if ($b=bc) $b=ab;
?><input type type=checkbox name=<?hehe{$a}?> value=<?$b?>>
……
……
<? endfor; ?>

解决方案 »

  1.   

    错了!
    更正:
    //2.php
    <form action="add.php",method="post">
    <table>
    <?
    $zhi="bc";
    for($a=1;$a<=50;$a++):
    if ($zhi=="bc")
    $zhi="ab";
    else $zhi="bc";
    ?>
    <td>
    <input type=checkbox name=<?echo "hehe{$a}"?> value=<?echo $zhi?>>111
    </td>
    <? endfor; ?>
    <td><input type=submit vlaue="ok"></td>
    </table>
    //——————
    //add.php
    <?
     for($a=1;$a<=50;$a++)
    { $dhehe= "hehe{$a}" ;
    echo $dhehe."<br>";
    echo ${$dhehe}."<br>";
    }
    ?>
      

  2.   

    再更正:
    错了!
    更正:
    //2.php
    <form action="add.php",method="post">
    <table>
    <?
    $zhi="bc";
    for($a=1;$a<=50;$a++):
    if ($zhi=="bc")
    $zhi="ab";
    else $zhi="bc";
    ?>
    <td>
    <input type=checkbox name=<?echo "hehe{$a}"?> value=<?echo $zhi?>><?echo $zhi?>
    </td>
    <? endfor; ?>
    <td><input type=submit vlaue="ok"></td>
    </table>
    //——————
    //add.php
    <?
    for($a=1;$a<=50;$a++)
    { $dhehe= "hehe{$a}" ;
    echo $dhehe."<br>";
    echo ${$dhehe}."<br>";
    }
    ?>
      

  3.   

    我怎么不大懂;
    我这个程序是网上考试;在第一页里是多选题50道;name=t1[]  ...name=t50[]
    再数据库里有标准答案;我想把每个提交的多选题(数组)转变成字符串,好跟答案比较;
    可是我用不想这样 $t1=join("",$t1)$t50=join("",$t50)
    这样写50次,怎么实现??
      

  4.   

    你可以用连接符.来处理,用自赋值.=算
    //add.php
    <?
    for($a=1;$a<=50;$a++)
    { $dhehe= "hehe{$a}" ;
    echo $dhehe."<br>";
    echo ${$dhehe}."<br>";
    $s.="${$dhehe}";
    echo $s;
    }
    其中的$s就是你想要的字符串!