Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/12/2010, 10:53
arros
 
Fecha de Ingreso: noviembre-2009
Mensajes: 535
Antigüedad: 14 años, 4 meses
Puntos: 25
Respuesta: Ayuda con insert multi data pls

gracias por responder
si los datos estan enviados atraves de un formulario
aqui tienes el formulario
Código PHP:
Ver original
  1. <form action="confer.php" method="post" name="insert_form_price">
  2. <table width="900px" cellspacing="1" cellpadding="1">
  3.  
  4.     <tr>
  5.    
  6.         <td width='25' colspan='1'>
  7.         <input type='button' class='button' value=' < ' onClick='<?php echo "goLastMonth($month,$year,\"$form\",\"$field\")"; ?>'>
  8.         </td>
  9.         <td width='125' align="center" colspan='5'>
  10.    
  11.         <span class='title'><input type="text" name="month" value="<?php echo $month; ?>"  /><input type="text" name="year[]" value="<?php echo $year; ?>"  /></span><br>
  12.        
  13.         </td>
  14.         <td width='25' colspan='1' align='right'>
  15.         <input type='button' class='button' value=' > ' onClick='<?php echo "goNextMonth($month,$year,\"$form\",\"$field\")"; ?>'>
  16.      
  17.         </td>
  18.     </tr>
  19.  
  20.    
  21. <?php
  22.  
  23.     for($i = 1; $i < $days; $i++)
  24.     {
  25.        
  26.         $timeStamp = strtotime("$year-$month-$i");
  27.         if($i == 1)
  28.         {
  29.         echo '<td>Fecha </td>';
  30.         //$firstDay = date("w", $timeStamp);
  31.         for($j = 1; $j < $days+1; $j++)
  32.         {
  33.        echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><input type='text' size='2' autocomplete='on' name='date' value='".$j."' /></td>";
  34.         }
  35.         }
  36.         // Workout when the first day of the month is
  37.        
  38.     }
  39.         echo '</tr>';
  40.        
  41.         $query = "SELECT * FROM tipo_hab ORDER BY id_hab LIMIT 0, 5";
  42.         $result = mysql_query($query, $GLOBALS['DB']);
  43.         //echo '<tr>';
  44.         while ($row = mysql_fetch_array($result))
  45.    
  46.         {
  47.         echo '<tr>';       
  48.        
  49.         $i = 0;
  50.         echo '<td><input type="text" name="id_hab" value="'.$row['id_hab'].'" />';
  51.         echo '</td>';
  52.         for($j = 0; $j < $days; $j++)
  53.         {
  54.         echo '<td width="25"><input type="text" size="2" name="precio" /></td>';
  55.        
  56.         }
  57.         echo '</tr>';
  58.        
  59.         }
  60.         mysql_free_result($result);
  61.          $date1 = date('$year-$month-$j');
  62.     ?>
  63.         <tr>
  64. <td colspan="<?php $i - 2; ?>"><input type="reset" value="Borrar" /></td>
  65. <td><input type="submit" value="Guardar" /></td>
  66. </tr>
  67.  
  68. </table>
  69. </form>