Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/09/2012, 10:28
Avatar de Perr0
Perr0
 
Fecha de Ingreso: mayo-2005
Ubicación: Santiago de Chile, Chile
Mensajes: 676
Antigüedad: 18 años, 10 meses
Puntos: 79
Respuesta: Inserta varias veces desde php

algo así te puede servir, ocupa DOM para insertar...
al final tendrás un array de datos y de ahí extraes para cada insert,
lo hice para dos campos, pero le puedes agregar los que faltan.

Código PHP:
Ver original
  1. <style>
  2. body, pre{margin:0;padding:0;font-family:Verdana, Geneva, sans-serif;font-size:12px}
  3. .nb{border: none;}
  4. table{border-collapse:collapse;margin:10px 0;font-size:12px;}
  5. table th{padding:4px 2px; background-color:FFFF80}
  6. table td{padding:1px 2px;}
  7. </style>
  8. <script>
  9. var numRow = 1;
  10. window.onload = function(){ tabla = document.getElementById("t").getElementsByTagName("tbody")[0];}
  11.  
  12. function addRow(){
  13.     crearTR = document.createElement("tr");
  14.     for(col=0 ; col<4; col++){
  15.         crearTD = document.createElement("td");
  16.         crearBoton = document.createElement("input");
  17.         crearBoton.setAttribute("type", "button");
  18.         crearBoton.setAttribute("value", "-");
  19.         crearBoton.onclick = function(){delRow(this.parentNode.parentNode)};
  20.         nRw = document.createTextNode(numRow);
  21.         tt = document.createTextNode("hola");
  22.         crearINP1 = document.createElement("input");
  23.         crearINP2 = document.createElement("input");
  24.         crearINP1.className = "nb";crearINP2.className = "nb";
  25.         crearINP1.setAttribute("size", 10);crearINP2.setAttribute("size", 10);
  26.         crearINP1.setAttribute("name", "datos[campo1][]");crearINP2.setAttribute("name", "datos[campo2][]");
  27.         if(col==0) crearTD.appendChild(crearBoton)
  28.         else if(col==1) crearTD.appendChild(nRw)
  29.         else if(col==2) crearTD.appendChild(crearINP1);
  30.         else if(col==3) crearTD.appendChild(crearINP2);
  31.         crearTR.appendChild(crearTD);
  32.     }
  33.     tabla.appendChild(crearTR);
  34.     numRow++;
  35. }
  36.  
  37. function delRow(obj){tabla.removeChild(obj);}
  38.  
  39. function delAll(){while (tabla.childNodes[0]){tabla.removeChild(tabla.childNodes[0]);}
  40. }
  41. </script>
  42. <form method="post">
  43. <input type="button" value="Agregar Fila" onClick="addRow()">
  44. <input type="button" value="Eliminar Todo" onClick="delAll()">
  45. <input type="submit" >
  46. <table width="0" border="1" cellpadding="0" cellspacing="0" id="t" >
  47.   <thead>
  48.   <tr>
  49.     <th width="24">-</th>
  50.     <th width="24">num</th>
  51.     <th>campo_1</th>
  52.     <th>campo_2</th>
  53.   </tr>
  54.   </thead>
  55.   <tbody>
  56.   </tbody>
  57. </table>
  58. </form>
  59. <?
  60. echo "<hr>codigo para insertar<br>";
  61. if(!$_POST["datos"] || !is_array($_POST["datos"])) exit;
  62. echo "<pre>";print_r($_POST["datos"]);echo "</pre>";
  63. ?>

salu2
__________________
Numerador Mp3 en Access =)
http://www.mediafire.com/download/r9...pdw/mp3(2).zip