Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/09/2015, 13:51
Avatar de marynella
marynella
 
Fecha de Ingreso: septiembre-2015
Ubicación: Bogota
Mensajes: 57
Antigüedad: 8 años, 8 meses
Puntos: 1
Respuesta: Guardar nombre varios archivos en phpmyadmin

Mira mi codigo:
Código PHP:
Ver original
  1. <?php
  2.         $conta = 'SELECT MAX(num_ingreso) AS num_ingreso FROM registro_ingreso';
  3.             $bus = $conexion->query($conta);
  4.  
  5.             if ($bus->num_rows > 0){
  6.                 $fila = $bus->fetch_array();
  7.                     $n = 1 + $fila["num_ingreso"];
  8.             }
  9.        
  10.         if(isset($_POST['registro'])){ 
  11.             if ($result = $conexion->query("INSERT INTO registro_ingreso (num_ingreso ,fecha_ingreso ,nombre, herramienta_ingresada, imagen ,empresa, salida_herramienta ,herramienta_retirada)
  12.                     VALUES ('$n','{$_POST['fecha']}','{$_POST['nombre']}','{$_POST['ingreso']}','{$_POST['fotos']}','{$_POST['empresa']}','{$_POST['salida']}','{$_POST['retiro']}')"))
  13.                 {
  14.                     echo'<script>
  15.                         alert("Registro Exitoso");
  16.                         window.location.href="../index.php";
  17.                     </script>';
  18.                 }else{
  19.                     echo'<script>
  20.  
  21.                         alert("Registro No Guardado");
  22.                         window.location.href="formato.php";
  23.  
  24.                     </script>';
  25.                 }
  26.         }
  27.  
  28.        
  29.     ?>

Código HTML:
Ver original
  1. <form name="formulario" id="formulario" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">                                                                                                
  2.             <div align="center"><table id="tabla" width="97%" border="0"><br>          
  3.             <tr>
  4.                     <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>N° Ingreso</b></td>
  5.                     <td width="100" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Fecha Ingreso</b></td>
  6.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Nombre</b></td>
  7.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Herramienta Ingresada</b></td>             
  8.                 <td width="160" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Empresa</b></td>
  9.                     <td width="150" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Fecha Salida de Herramientas</b></td>
  10.                 <td width="150" style="border: 2px solid #016495;"><center><font color="white" size="3"/><b>Herramienta Retirada</b></td>              
  11.                 </tr>
  12.             <tr bgcolor="#ffffff">
  13.                 <td><center><input type="text" size="3" value="<?php echo $n;?>" style="border:none; text-align:center; background-color:#ffffff" readonly/></center></td>
  14.                 <td><center><input type="date" name="fecha" style="border:none; background-color:#ffffff; text-align:center" required/></td>
  15.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="nombre"  required></textarea></td>
  16.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="ingreso" required></textarea></td>
  17.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="empresa" required></textarea></td>             
  18.                 <td><input type="date" name="salida" size="16" style="border:none; background-color:#ffffff; text-align:center" required/></td>
  19.                 <td><textarea cols="22" rows="3" maxlength="30" style="border:none; background-color:#ffffff" name="retiro" required></textarea></td>
  20.             </tr>      
  21.         </table></div>
  22.         <div align="center"><table id="archivos" width="97%" border="0">
  23.             <tr>
  24.                 <td width="15%"><font color="white" size="3"/><b>Adjuntar imagen:</b></td>
  25.                 <td bgcolor="#ffffff"><input type="file" name="fotos" style="background-color:#ffffff" required/><td>
  26.                 </tr>
  27.         </table>
  28.        
  29.     </form>