tengo un problema.. cree un form que contiene un archivo que se puede adjuntar
el problema es que no se porque... al ponerle ok la primera vez en el form me queda el navegador "cargando".. pero no avanza....
si le hago nuevamente click al submit del form, me ingresa los valores, y me ingresa 2 registros, uno parcial (sin el archivo que estoy subiendo) y otro completamente ok...
espero me puedan ayudar.
este es el codigo php que ingresa los valores... al parecer el error es con el archivo que subo, pues si le elimino lo que tenga que ver con el archivo, ingresa altiro
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-image: url(../imagenes/bg.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #FFFF00;
}
a:visited {
color: #FFFF00;
}
a:hover {
color: #FFFFFF;
}
a:active {
color: #FFFF00;
}
.style13 {font-size: 12px; color: #FFFFFF; }
-->
</style>
<link href="../css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
<table width="100%" height="50" border="0">
<tr>
<td valign="bottom"><div align="center" class="style13">
<div align="center"><img src="http://www.forosdelweb.com/f18/imagenes/axiomalogo2.gif" alt="logo" width="211" height="75" /></div>
</div></td>
<td valign="bottom"><div align="center"><img src="http://www.forosdelweb.com/f18/imagenes/sga1.gif" alt="scc" width="480" height="43" /></div></td>
</tr>
</table>
<table width="90%" border="0" bgcolor="#1C1C1C">
<tr>
<td><div align="center" class="titulo1">
<?php
mysql_connect("localhost", "xxxx", "xxxx");
mysql_select_db("administracion");
$nombre_reg=$_POST['nnombre'];
$rut_reg=$_POST['rrut'];
$institucion=$_POST['institucion'];
$nombre_curso=$_POST['nombre_curso'];
$ccc = "http://localhost/admin_contrato/php/"; //datos archivo
$directorio = 'baseslicita/'; //datos archivo
$nombre_archivo_capa = $HTTP_POST_FILES["archivo_capa"]["name"]; //datos archivo
$tipo_archivo_capa = $HTTP_POST_FILES["archivo_capa"]["type"]; //datos archivo
$tamano_archivo_capa = $HTTP_POST_FILES["archivo_capa"]["size"]; //datos archivo
$nom_img_capa= time().$nombre_archivo_capa; //datos archivo
$nom_img_capa_sin_espacio = str_replace(" ", "", $nom_img_capa);
if(move_uploaded_file($HTTP_POST_FILES['archivo_capa']['tmp_name'],$directorio . $nom_img_capa_sin_espacio)) //datos archivo
{ $archivo_capacitacion= $ccc . $directorio . $nom_img_capa_sin_espacio; } //datos archivo
if ($_POST['institucion']=='' or $_POST['nombre_curso']=='')
{
echo "<script>history.back(alert(\"Debes ingresar todos lo campos \"));</script>";
}
else
{
mysql_query("INSERT INTO capacitaciones (nombre_completo , rut , institucion , nombre_curso , archivo) VALUES ('$nombre_reg' , '$rut_reg', '$institucion', '$nombre_curso' ,'$archivo_capacitacion' )");
echo "Se ha ingresado un nuevo registro exitosamente<br>";
echo "Espera, se redireccionará automáticamente";
?>
<script language="JavaScript" type="text/javascript">
setTimeout("url()",2500);
function url()
{
window.location="../administracion.php";
}
</script>
<?php
}
?>
</div></td>
</tr>
</table>
</div>
<p align="center"> </p>
</body>
</html>