Ver Mensaje Individual
  #7 (permalink)  
Antiguo 06/02/2013, 09:14
proteus8
 
Fecha de Ingreso: junio-2008
Ubicación: Osorno
Mensajes: 155
Antigüedad: 15 años, 10 meses
Puntos: 3
Respuesta: Grabar contenido de varios textbox

hola satjaen y gracias por querer ayudar, seguí los pasos del link que me dejaste, pero no logro grabar datos en la base , aquí dejo mi código por si me pueden ayudar por fa.

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Documento sin título</title>
  5. </head>
  6. <form name="socio_new" method="post" action="index.php">
  7.  <table>
  8.   <tr>
  9.   <td width="620" colspan="3" bgcolor="#246A07" >Cursos</td>
  10.   </tr>
Código PHP:
Ver original
  1. <?php
  2. include("Api/Conections/conexion.php");
  3. include("Api/functions/funciones.php");  
  4. $sql = mysql_query("SELECT cod,id_curso,nombre FROM temp
  5. LEFT JOIN cursos on temp.ID_CURSO=cursos.id
  6. where cod='123'");
  7. while ($row=mysql_fetch_array($sql))
  8. {
  9. $NOMBRE_CURSO=$row['nombre'];
  10. $ID_cur=$row['ID_CURSO'];
  11. echo"
  12. <tr>
  13. <td  bgcolor='#72B446'>$NOMBRE_CURSO</td>
  14. <td><input name='ben[]' id='$i' type='text'/></td>
  15. <td><input name='rel[]' id='$i' type='text'/></td>
  16. </tr>";
  17. }
  18.   ?>
Código HTML:
Ver original
  1.  <table>
  2.     <tr>
  3.         <td><input name="grabar" id="grabar" type="submit" value="Finalizar"></td>
  4.         <!-- Este es el boton que quiero que al presionarlo me grabe en una base de datos -->
  5.     </tr>
  6.  </table>
  7.  </form>
Código PHP:
Ver original
  1. <?php
  2. if($grabar!="")
  3.     {
  4. $ben = $_POST['ben'];
  5. $rel = $_POST['rel'];
  6.  
  7. $total = count($ben);
  8. for ($i = 0; $i < $total; $i++) {
  9.         $beneficiario = $ben[$i];
  10.         $relacion = $rel[$i];
  11.        
  12. $sql_insert= sprintf("INSERT INTO prueba (curso,ben,rel)
  13. VALUES ('$ID_cur')",
  14. GetSQLValueString($_POST['ben'], "text"),
  15. GetSQLValueString($_POST['rel'], "text"));
  16. mysql_query($sql_insert);
  17. }  
  18.  
  19. }
  20. ?>
Código HTML:
Ver original
  1. </body>
  2. </html>

Desde ya muchas gracias!!!!!