Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/03/2009, 14:52
Avatar de spolli
spolli
 
Fecha de Ingreso: diciembre-2008
Mensajes: 68
Antigüedad: 15 años, 5 meses
Puntos: 0
los registro se ingresan vacios a la bd

Hola, me pasa algo raro tengo hecho un script que subo archivo por formulario y guardo la ruta en la bd hasta ahi el script funciona , pero cuando en el mismo script quiero ingresar registro los registro se ingresan vacios a la bd, me fije mil veces el script y no le encuentro el error

formulario
Código HTML:
<form action="2.php" method="post" enctype="multipart/form-data">
    Archivo: <input name="fichero" type="file">
    
    <p>
    Titulo
      <label>
      <input name="titulo" type="text"/>
      <input name="despues" type="text"/>
      <input name="cuerpo" type="text"/>
      <input name="submit" type="submit" value="Subir"></label> 
</form> 
donde guardo la ruta del archivo subido y los registros a la bd
Código PHP:
<?php $link=mysql_connect("localhost","root","pass");
mysql_select_db("sistema_de_noticias",$link);

if (isset(
$_POST['submit'])){
if (
is_uploaded_file($_FILES['fichero']['tmp_name'])){
   
$ruta"foto/".$_FILES['fichero']['name'];
   if(
move_uploaded_file($_FILES['fichero']['tmp_name'],$ruta)){ 
   
              
              
mysql_query("INSERT INTO imagenes (ubicacion,fecha) VALUES ('$ruta',NOW())",$link)or die (mysql_error());
             
        }
     } 
 } 
 
 
$sql="INSERT INTO tabla (titulo,despues,cuerpo,autor) VALUES ('$titulo','$despues','$cuerpo','$autor')"

mysql_query($sql,$link);
 
header("location:3.php");
?>