Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2012, 02:38
echo_
 
Fecha de Ingreso: noviembre-2011
Ubicación: Paris
Mensajes: 450
Antigüedad: 13 años, 2 meses
Puntos: 7
problemas select

Buenas noches a todos, mi problema es el siguiente tengo 4 hojas 1 donde se ingresa la matricula para iniciar session la 2 me valida la 3 igual pero en la 4 quiero hacer un query que me seleccione los datos de una tabla con la matricula que ingrese en la primera hoja, ya lo he echo pero solo de una pagina a otra, Espero y me puedan ayudar por favor, este es mi codigo:

pag1
Código PHP:
<html>
<
head>

</
head>
<
body>
<
form action="2.php" method="post">
Ingrese su matricula:<input type='text' name='matricula' /><br><br>

<
input type="submit" value="confirmar">
</
form>
</
body>
</
html
pag2
Código PHP:
<?php
$matricula
=$_POST['matricula'];


if(
$matricula)
{
include 
"config.php";

$consulta=mysql_query("SELECT * FROM registrados WHERE matricula='".$matricula."'");
$filas=mysql_fetch_array($consulta);

$matriculabd=$filas['matricula'];
$id=$filas['id'];

if(
$matricula==$matriculabd){

session_start();

$_SESSION['usuario']=$matriculabd;
$_SESSION['id']=$id;






echo 
"

<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=3.php'>
<script>
alert('Bienvenido');
</script>

</head>
</html>


"
;


}
else{

echo 
"

<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Has ingresado una matricula incorrecta, intente de nuevo!');
</script>

</head>
</html>


"
;

}



}
else{

echo 
"

<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Favor de ingresar su matricula!');
</script>

</head>
</html>


"
;



}

?>
pag3
Código PHP:
<?php
session_start
();
$usuario=$_SESSION['usuario'];
$id=$_SESSION['id'];

if(
$usuario AND $id){
//echo "holaaaaaa"."<a href='cerrarsession.php'>Cerrar</a>";





echo "

<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=4.php'>
<script>

</script>

</head>
</html>


"
;

}
else{

echo 
"

<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Matricula incorrecta!');
</script>

</head>
</html>


"
;

}
?>
pag4
Código PHP:
<?php
session_start
();


    include 
"config.php";
   
    
$registros=mysql_query("select * from registrados where matricula='$_REQUEST[matricula]'",$conexion) or
    die(
"Problemas en el select:".mysql_error());


if (
$reg=mysql_fetch_array($registros)) 

  echo 
"Nombre:".$reg['nombre']."<br>"
  
  
  

else 

  echo 
"No existe un alumno con ese mail."

mysql_close($conexion); 
?>