Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/06/2010, 11:57
psm2009b
 
Fecha de Ingreso: agosto-2009
Mensajes: 7
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Pasar por array el contenido de input text y guardar a mysql

Esta modificación le hice yo, lo cual al imprimirlo en otra página con la función print_r($_POST) me muestra el resultado como debe ser, pero la duda me surge en cómo le digo al archivo que inserta los datos a mysql que el nombre real del campo es c1 y no el ID del estudiante.
Código PHP:
Ver original
  1. <?php
  2. require("config/config.inc.php");
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <title>Documento sin título</title>
  9. </head>
  10.  
  11. <body>
  12. <?php
  13. $rows=mysql_query("SELECT * FROM calificaciones ORDER BY estudiante ASC");
  14. echo mysql_error();
  15. ?>
  16. <form action="action_c1.php" method="post" name="form1" id="form1">
  17.     <table>
  18.         <tr>
  19.             <th>
  20.                 Estudiante
  21.             </th>
  22.             <th>
  23.                 C1
  24.             </th>
  25.         </tr>
  26.         <?php
  27.         while($row=mysql_fetch_array($rows)){
  28.             $identifier=$row['ID'];
  29.         ?>
  30.         <tr>
  31.             <td><?php echo $row['estudiante'];?></td>
  32.             <td><input type="text" name="<?php echo $identifier ?>" id="c1" value="" maxlength="3" style="font-family:Verdana, Geneva, sans-serif; font-size: 7pt; text-align: center" size="3" /></td>
  33.         </tr>
  34.         <?php
  35.         }
  36.         ?>
  37.         <tr>
  38.             <td colspan="2">
  39.                 <input type="submit" value="Grabar" />
  40.             </td>
  41.         </tr>
  42.     </table>
  43. </form>
  44. </body>
  45. </html>