Informatica

Páginas: 2 (291 palabras) Publicado: 22 de noviembre de 2012
p1.php
<html>
<head>
<title>Problema</title>
</head>
<body>
<form action="p2.php" method="post">
Ingrese el mail delalumno:
<input type="text" name="mail"><br>
<br>
<input type="submit" value="buscar">
</form>
</body>
</html>

P2.php<html>
<head>
<title>Problema</title>
</head>
<body>
<?php
//SE REALIZA LA CONEXION
$conexion=mysql_connect("localhost","root","123") ordie("Problemas en la conexion");
//SE SELECCIONA LA BASE DE DATOS
mysql_select_db("phpfacil",$conexion) or die("Problemas en la selección de la base de datos");
//SEREALIZA LA BUSQUEDA
$registros=mysql_query("select * from alumnos where mail='$_REQUEST[mail]'",$conexion) or die("Problemas en el select:".mysql_error());
//permite recuperardatos de tablas con el comando SELECT
//si existe el mail se mete dentro del if
//si el if se verifica verdadero se ejecuta un bloque que contiene código HTML:
if($reg=mysql_fetch_array($registros))
{
?>
Tutorial: php desde cero Pedro López Salazar ITSZ 11/julio/2011
//se ingresa al 2do formulario
<form action="p3.php"method="post">
//aparece el mail a modificar
Ingrese nuevo mail : <input type="text" name="mailnuevo" value=" <?php echo $reg['mail'] ?>">
<br>
//editas elnuevo mail y se envia
<input type="hidden" name="mailviejo" value="<?php echo $reg['mail'] ?>">
<input type="submit" value="Modificar">
</form><?php
}//en caso que no cumpla la condicion mostrar mensaje que no existe el mail
else
echo "No existe alumno con dicho mail";
?>
</body>
</html>
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informática
  • Informatica
  • Informatica

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS