本帖最后由 xiachao2008 于 2011-10-24 18:17:11 编辑

解决方案 »

  1.   

    在列表页面把id传过去,,在编辑页面形成一个二维数组就好办了。
    $data=array(
        array('11','11','11'),
        array('22','22','22'),
        array('','33','33'),
    )
    然后遍历插入数据库即可。
      

  2.   

    不知道你的批量修改是什么意思 是所有的tr中的td全部变成输入框还是某一个tr?
      

  3.   

    <input name="a[]" value="1">
    <input name="a[]" value="2">程序:$_POST['a']  就是array("1","2")
      

  4.   

    在你们的帮助下总于快完成了,我改成了这样,但是还差最后一小点问题。
    update.php页面:if(isset($_POST["act"]) && $_POST["act"]="act")
    {
    $array_id=$_POST["id"];
    $array_content=$_POST["content"];
    $array_apple=$_POST["apple"];
    $date=array($array_id,$array_content,$array_apple);       for($i=0,$size=count($date);$i<$size;$i++){
    $update_sql="update exmple set content='{$_POST["content"][$i]}' ,apple='{$_POST["apple"][$i]}' where id = {$_POST["id"][$i]}";
    $update_sql.=";";
    mysql_query($update_sql);
    echo $update_sql;} index.php页面 $sql="select *from exmple";
      $rs=mysql_query($sql);
      $count_result=mysql_num_rows($rs);
      echo $count_result."</br>";
    echo "<table>";
      while($new=mysql_fetch_array($rs))
      {
      echo "<tr>";
      echo "<td><input  name=id[] value=$new[id] ></td>";
      echo "<td><input  name=content[] value=$new[content] ></td>";
      echo "<td><input  name=apple[] value=$new[apple] ></td>";
    echo "</tr>";  }
      echo "</table>";
    ?>
    <input type="hidden" name="act" value="act"></input>
    <input type="submit" name="submit"></input>
      </form>
    批量修改不成功,但是我把SQL语句输出来,放在PHPmyadmin里去执行,是成功了的。这是怎么回事啊??
      

  5.   


    if(isset($_POST["act"]) && $_POST["act"]="act")
    {
        $array_id      =  $_POST["id"];
        $array_content =  $_POST["content"];
        $array_apple   =  $_POST["apple"];
      
        for($i=0;$i<count($array_id);$i++){
            echo $update_sql=" UPDATE `exmple` SET content='{$array_content[$i]}' ,apple='{$array_apple[$i]}' where id = {$array_id[$i]}";
            //mysql_query($update_sql);
            echo "<br/>";
        }
    }
      

  6.   

    感谢,
    是我忘记在update里写数据库连接了