大家进来解决这个问题

大家进来解决这个问题

我绑定了一个记录集,我想更新某个记录里面的数据,我用记录集的id传递,值就是绑定记录集的id的值.为什么我传递这个id更新记录时老是出错,传递的id总是第一个或者是最后一个的,想任意更新某一个id的数据不行.搞不懂那里出错了,:唉
长流不息

发代码出来啊
毕业了。。。

代码

<form name="form1" method="post" action="update.php">
    <table width="790" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="12"><div align="center"><img src="image/xx.jpg" width="790" height="130"></div></td>
      </tr>
      <tr>
        <td height="30" colspan="12" class="top style1"><div align="left"><a href="admin.php">返回</a> | <a href="<?php echo $FF_Logout ?>">退出登陆</a></div></td>
      </tr>
      <tr>
        <td height="1" colspan="12"><hr></td>
      </tr>
      <tr>
        <td height="30" colspan="12" class="top style1"><div align="left">学号为<span class="style12"><?php echo $row_name['a_name']; ?></span>的学生的选课情况</div></td>
      </tr>
      <tr class="index_font">
        <td width="107" height="20"><div align="center"><span class="style1">学号</span></div></td>
        <td width="98" height="20"><div align="center"><span class="style7">年度</span></div></td>
        <td width="71" height="20"><div align="center"><span class="style7">学期</span></div></td>
        <td width="42" height="20"><div align="center"><span class="style7">班次</span></div></td>
        <td width="230" height="20"><div align="center"><span class="style7">课程名称</span></div></td>
        <td width="51" height="20"><div align="center"><span class="style7">成绩</span></div></td>
        <td width="51" height="20"><div align="center"><span class="style7">学时</span></div></td>
        <td width="51" height="20"><div align="center"><span class="style7">学分</span></div></td>
        <td width="75" height="20"><div align="center"><span class="style7">开课单位</span></div></td>
        <td width="76" height="20"><div align="center"><span class="style7">所属类别</span></div></td>
        <td width="38" height="20"> </td>
        <td width="44" height="20"> </td>
      </tr>
      <?php $bgcolor="#fff9e8";
        do {if($bgcolor=="#fff9e8")$bgcolor="#F0FFFF";
        else $bgcolor="#fff9e8"; ?>
        <tr bgcolor="<?php echo $bgcolor;?>">
        <td height="20"><?php echo $row_name['a_name']; ?></td>
        <td height="20"><?php echo $row_name['term']; ?></td>
        <td height="20"><?php echo $row_name['updown']; ?></td>
        <td height="20"><?php echo $row_name['class']; ?></td>
        <td width="150" height="20"><?php echo $row_name['subject']; ?></td>
        <td height="20"><input name="cj" type="text" id="cj" value="<?php echo $row_name['cj']; ?>" size="3"></td>
        <td height="20"><?php echo $row_name['classtime']; ?></td>
        <td height="20"><?php echo $row_name['fen']; ?></td>
        <td width="130" height="20"><?php echo $row_name['unit']; ?></td>
        <td width="150" height="20"><?php echo $row_name['lei']; ?></td>
        <td height="20"><input name="a_id" type="hidden" id="a_id" value="<?php echo $row_name['a_id']; ?>">
          <input name="a_name" type="hidden" id="a_name" value="<?php echo $row_name['a_name']; ?>">
          </td>
        <td height="20"><input type="submit" name="Submit" value="更新"></td>
      </tr>
      <?php } while ($row_name = mysql_fetch_assoc($name)); ?>
    </table>
  </form>

更新页面如下
<?php require_once('Connections/xuanke.php');
mysql_select_db($database_xuanke,$xuanke);
echo $a=$_POST['a_id'];
echo $b=$_POST['a_name'];
echo $c=$_POST['cj'];
$updatecommand="update admin set cj='$c' where a_id='$a'";
mysql_query($updatecommand,$xuanke);
header("location:admincheckname.php?a_name='$b'");
?>
长流不息

form里边的数据重复了吧
form的每个文本域名字是相同的
你循环赋值只能赋到最后一个
如履薄冰