while($row = mssql_fetch_array($rs)){
echo "<tr>";
//for($n=1;$n<3;$n++){
echo "<td><input id=\"D[]\" name=\"A[]\" type=\"checkbox\" value=\"$row[ID]\" />$row[Name]</td>";
}
echo "</tr>";
// }
这样的话就是每行重复两个 呵呵 不可以

解决方案 »

  1.   


       echo "<tr>";
    while($row = mssql_fetch_array($rs)){
                                 
                                    //for($n=1;$n<3;$n++){
                                        echo "<td><input id=\"D[]\" name=\"A[]\" type=\"checkbox\" value=\"$row[ID]\" />$row[Name]</td>";
                                        }
                                        echo "</tr>";
                                    //    }
    你现在不就是多列吗?
      

  2.   


    $i=0;
    while($row = mssql_fetch_array($rs)){ 
                                 echo "<tr>";                             
                                    //for($n=1;$n<3;$n++){
                                        echo "<td><input id=\"D[$i]\" name=\"A[$i]\" type=\"checkbox\" value=\"$row['ID']\" />$row['Name']</td>";
                                        }
                                        echo "</tr>";
      $i++;
                                    //    }
      

  3.   


    $i=0;
    while($row = mssql_fetch_array($rs)){ 
                                 echo "<tr>";                             
                                    //for($n=1;$n<3;$n++){
                                        echo "<td><input id=\"D[".$i."] name=\"A[".$i.]" type=\"checkbox\" value=\".$row['ID'].\" />".$row['Name']."</td>";
                                        }
                                        echo "</tr>";
      $i++;
                                    //    }要注意单双引号!
      

  4.   

    $列数 = 3;
    $col = 0;
    while($row = mssql_fetch_array($rs)) {
      if($col == 0) echo '<tr>';
      echo "<td><input name='A[]' type='checkbox' value='$row[ID]'>$row[Name]</td>";
      $col = ($col + 1) % $列数;
      if($col == 0) echo '</tr>';
    }