Código:
foreach($_POST["clave3"] as $key => $value){ $updateSQL = sprintf("UPDATE calificar SET rfcalumno=%s, parcial1=%s,parcial2=%s,parcial3=%s,promedio=%s WHERE claveasignatura=%s", GetSQLValueString($_POST['clave3'][$key], "text"), GetSQLValueString($_POST['p1'][$key], "text"), GetSQLValueString($_POST['p2'][$key], "text"), GetSQLValueString($_POST['p3'][$key], "text"), GetSQLValueString($_POST['prom'][$key], "text"), GetSQLValueString($_POST['claveasignatura'], "text")); mysql_select_db($database_connection, $connection); $Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
esto es mi formulario q se repite
Código HTML:
<form action="<?php echo $editFormAction; ?>" method="post" id="form1"> <table border="0" class="normal"> <thead> <tr> <td></td> <td>rfc</td> <td>nombre</td> <td>apellido paterno</td> <td>apellido Materno</td> <td>Parcial 1</td> <td>Parcial 2</td> </tr> </thead> <?php do { ?> <tbody> <tr> <td><?php $i+=1; echo $i;?></td> <td ><input type="text" name="clave3[]" id="clave3" value="<? echo $row_alumnos2['rfcalumno']; ?>" size="20" style="border: none; "/></td> <td><? echo $row_alumnos2['Nombre']; ?></td> <td><?php echo $row_alumnos2['ApellidoPaterno']; ?></td> <td><?php echo $row_alumnos2['ApellidoMaterno']; ?></td> <td><input type="text" name="p1[]" id="p1" value="<?php echo $row_alumnos2['parcial1']; ?>" size="3" style="border: none;" /> </td> <td><input type="text" name="p2[]" id="p2" value="" size="3" style="border: none;" /> </td> <input type="hidden" name="p3[]" id="p3" value="" size="3" style="border: none;" /> <input type="hidden" name="prom[]" id="prom" value="<?php ?>" size="3" style="border: none;" /> </td> </tr> </tbody> <?php } while ($row_alumnos2 = mysql_fetch_assoc($alumnos2)); ?> </table> <p>