Proyecto: Agenda de contactos en PHP

35
PROYECTO AGENDA LEER ANTES, IMPORTANTE: Proyecto con solo la primera parte terminada en la que se ha creado una agenda con todos los datos necesarios en una tabla. Falta la segunda parte en la que se crea la misma agenda pero con los datos en diferentes tablas y con integridad referencial entre ellas, y una posible tercera sin integridad referencial, haciendo el borrado, el editado de datos de usuario y de las notas mediante scripts 2011 Javier García Cambronel SEGUNDO DE ASIR 12/12/2011

description

2011PROYECTO AGENDALEER ANTES, IMPORTANTE: Proyecto con solo la primera parte terminada en la que se ha creado una agenda con todos los datos necesarios en una tabla. Falta la segunda parte en la que se crea la misma agenda pero con los datos en diferentes tablas y con integridad referencial entre ellas, y una posible tercera sin integridad referencial, haciendo el borrado, el editado de datos de usuario y de las notas mediante scriptsJavier García Cambronel SEGUNDO DE ASIR 12/12/2011[PR

Transcript of Proyecto: Agenda de contactos en PHP

Page 1: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA LEER ANTES, IMPORTANTE: Proyecto con solo la primera parte terminada en la que se ha creado una agenda con todos los datos necesarios en una tabla. Falta la segunda parte en la que se crea la misma agenda pero con los datos en diferentes tablas y con integridad referencial entre ellas, y una posible tercera sin integridad referencial, haciendo el borrado, el editado de datos de usuario y de las notas mediante scripts

2011

Javier García Cambronel SEGUNDO DE ASIR

12/12/2011

Page 2: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 1

CREACIÓN BASE DE DATOS AGENDA PRIMERA: UNA TABLA CON TODOS LOS CAMPOS

INDEX.HTML

CONFIG.PHP

AGREGAR.PHP

BUSCAR.PHP

EDITAR.PHP

BORRAR.PHP

EDITARNOTAS.PHP

FUNCIONAMIENTO DE LA AGENDA EN EL NAVEGADOR

PAGINA PRINCIPAL

COMPROBANDO AGREGAR CONTACTOS

CUANDO FALTA EL NOMBRE

CUANDO FALTA EL APELLIDO

CUANDO FALTA EL CORREO

CUANDO NO FALTA NADA

COMPROBANDO EL BUSCADOR (buscar.php)

COMPROBANDO LA SELECCIÓN DE USUARIOS, SU VISTA (ver.php)

COMPROBANDO LA FUNCIÓN DE EDITAR DATOS (editar.php)

COMPROBANDO EL BORRADO DE USUARIOS (borrar.php)

COMPROBANDO EL EDITADO DE NOTAS (editarnotas.php)

Page 3: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 2

CREACIÓN BASE DE DATOS AGENDA PRIMERA: UNA TABLA CON TODOS LOS CAMPOS

Lo primero que tenemos que hacer es crear un usuario para ello he optado hacerlo en modo

gráfico

Despues nos conectamos como ese usuario con el nombre y la contraseña como vemos en la

imagen y procedemos a crear la base de datos.

Creamos la base de datos

Y entramos en ella

Ahora creamos la tabla sobre la que vamos a trabajar

CREATE TABLE `personas` (

`id` int(8) NOT NULL auto_increment,

`nombre` varchar(180) default NULL,

`apellidos` varchar(180) default NULL,

`correo` varchar(180) default NULL,

`telefonofijo` int(12) default NULL,

`telefonomovil` int(12) default NULL,

`fax` varchar(180) default NULL,

`pais` varchar(15) default NULL,

`codigopostal` varchar(5) default NULL,

`direccion` varchar(180) default NULL,

`notas` TEXT default NULL,

`foto` varchar(280) default NULL,

PRIMARY KEY (`id`)

) ;

Page 4: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 3

INDEX.HTML

Es el que va a mostrar las opciones de agregar usuario y buscar los que ya tenemos en la

base de datos.

<!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=utf-8" />

<title>Agenda proyecto 2</title>

</head>

<style type="text/css">

.agenda {

margin:100px auto 0 auto;

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

<table width="100%" height="404" border="0">

<tr>

Page 5: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 4

<td height="38" colspan="3" align="center" valign="middle"><h1>Agenda

Proyecto 2</h1></td>

</tr>

<tr>

<td colspan="3" valign="top">SEGUNDO DE ASIR<br /><br /><center>

<a href="agregar.php"><img src="imagenes/agregar.png" width="128"

height="128" /></a><a href="buscar.php"><img src="imagenes/buscar.png" width="128"

height="128" /></a>

</center>

</td>

</tr>

</table>

</div>

</div>

</body>

</html>

Page 6: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 5

CONFIG.PHP

Es el que se va a encargar de hacer la conexión a la base de datos y si en algún futuro

tuviéramos que hacer algún cambio de base de datos bastaría con editar este archivo.

<?php

// Configuracion de la base de datos.

$dbhost = "localhost"; // Servidor

$dbuser = "javier"; // Usuario

$dbpass = "asir2012"; // Contraseña

$dbname = "agenda"; // Tabla

// Creando conexion.

$link = mysql_connect($dbhost,$dbuser,$dbpass); // Conectamos a la base de datos

mysql_select_db($dbname,$link); // Seleccionamos la base de datos

?>

Page 7: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 6

AGREGAR.PHP

Es el código que se va a encargar de registrar a los usuarios si cumplen una serie de

condiciones.

<?php

// Incluimos la configuracion y conexion a la MySQL.

include('config.php');

// Definimos la variable $msg por seguridad.

$msg = "";

// Si se aprieta el boton Registrar, da la condicion como true.

if ($_POST['registrar'])

{

// Verificamos que no tenga ningun dato considerado importante sin rellenar.

if(!empty($_POST['nombre']) AND !empty($_POST['apellidos']) AND

!empty($_POST['correo']))

{

// Pasamos los datos de los POST a Variables, y le ponemos seguridad.

$nombre = htmlentities($_POST['nombre']);

$apellidos = htmlentities($_POST['apellidos']);

$correo = htmlentities($_POST['correo']);

$telefonofijo = htmlentities($_POST['telefonofijo']);

$telefonomovil = htmlentities($_POST['telefonomovil']);

$fax = htmlentities($_POST['fax']);

$pais = htmlentities($_POST['pais']);

$codigopostal = htmlentities($_POST['codigopostal']);

$direccion = htmlentities($_POST['direccion']);

$foto = htmlentities($_POST['foto']);

$notas = htmlentities($_POST['notas']);

// Insertamos los datos en la base de datos, si da algun error lo muestra.

Page 8: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 7

$sql = "INSERT INTO personas (nombre, apellidos, correo, telefonofijo,

telefonomovil, fax, pais, codigopostal, direccion, foto, notas) VALUES

('".$nombre."','".$apellidos."','".$correo."','".$telefonofijo."',

'".$telefonomovil."','".$fax."','".$pais."','".$codigopostal."','".$direccion."','".$foto."','".$not

as."')";

mysql_query($sql,$link) or die(mysql_error());

// Mostramos un mensaje diciendo que todo salio como lo esperado

$msg = "Persona registrada en la agenda correctamente";

} else {

// Si hay un dato sin rellenar mostramos el siguiente texto.

$msg = "Falta rellenar algun dato importante. Recuerda que nombre

apellidos y correo son campos obligatorios";

}

}

?>

<!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=utf-8" />

<title>Agenda - Agregar personas</title>

</head>

<style type="text/css">

.agenda {

margin:100px auto 0 auto;

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

Page 9: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 8

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

<table width="100%" height="404" border="0">

<tr>

<td height="38" colspan="3" align="center" valign="middle"><h2>Agregar

contacto</h2></td>

</tr>

<tr>

<td colspan="3" valign="top"><center><em><span

style="color:red;"><?=$msg;?></span></em></center>

<form action="agregar.php" method="post">

<strong>Nombre</strong><br />

<input type="text" name="nombre" id="nombre" />

<br />

<strong>Apellidos</strong>

<br />

<input type="text" name="apellidos" id="apellidos" />

<br />

<strong>Correo electrónico</strong>

<br />

<input type="text" name="correo" id="correo" />

<br />

Page 10: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 9

<strong>Teléfono fijo</strong>

<br />

<input type="text" name="telefonofijo" id="telefonofijo" />

<br />

<strong>Teléfono móvil</strong>

<br />

<input type="text" name="telefonomovil" id="telefonomovil" />

<br />

<strong>Fax</strong>

<br />

<input type="text" name="fax" id="fax" />

<br />

<strong>País</strong>

<br />

<input type="text" name="pais" id="pais" />

<br />

<strong>Código Postal</strong>

<br />

<input type="text" name="codigopostal" id="codigopostal" />

<br />

<strong>Dirección</strong><br />

<input type="text" name="direccion" id="direccion" />

<br />

<strong>Link de la Foto</strong><br />

<input type="text" name="foto" id="foto" />

<br />

<strong>NOTAS</strong><br />

Page 11: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 10

<input type="text" name="notas" id="notas" />

<br />

<input type="submit" name="registrar" value="registrar" />

</form>

</td>

</tr>

</table>

</div>

</div>

</body>

</html>

Page 12: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 11

BUSCAR.PHP

Es el código que se va a encargar de buscar un usuario en nuestra base de datos,

mostrándonos como resultado el nombre y los apellidos del mismo.

<?php

// Incluimos la configuracion y conexion a la MySQL.

include('config.php');

// Definimos la variable $msg por seguridad.

$msg = "";

// Si se apreta el boton Buscar, da la condicion como true.

if($_GET['buscar'])

{

// Verificamos que no tengamos ningun dato sin rellenar.

if(!empty($_GET['q']))

{

$nombre = htmlentities($_GET['q']);

$sql = "SELECT * FROM personas WHERE nombre LIKE '%".$nombre."%'";

$query = mysql_query($sql,$link);

// Mostramos un mensaje diciendo que todo salió como lo esperado

$msg = "Resultados para el nombre ".$nombre;

} else {

// Si hay un dato sin rellenar mostramos el siguiente texto.

$msg = "Falta rellenar algun dato";

}

}

?>

<!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">

Page 13: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 12

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Agenda - Buscar personas</title>

</head>

<style type="text/css">

.agenda {

margin:100px auto 0 auto;

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

<table width="100%" height="404" border="0">

<tr>

<td height="38" colspan="3" align="center" valign="middle"><h1>Buscar

Personas</h1></td>

</tr>

<tr>

<td colspan="3" valign="top"><center><em><span

style="color:red;"><?=$msg;?></span></em></center><br />

Page 14: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 13

<center><form action="buscar.php" method="get">

<input type="text" name="q" id="q" />

<input type="submit" name="buscar" value="Buscar" />

</form></center><br />

<?php if($_GET['buscar'] && !empty($_GET['q'])){ ?>

<table width="100%" border="1">

<?php while($row = mysql_fetch_assoc($query)){ ?>

<tr>

<td>

<a href="ver.php?id=<?=$row['id']?>"><?=$row['nombre']?> <?=$row['apellidos']?></a>

</td>

</tr>

<?php } ?>

</table>

<?php } ?>

</td>

</tr>

</table>

</div>

</div>

</body>

</html>

Page 15: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 14

EDITAR.PHP

Es el código que se va a encargar de editar los datos de un usuario ya creado, modificando

solo los valores que cambiemos.

<?php

// Incluimos la configuracion y conexion a la MySQL.

include('config.php');

// Definimos la variable $msg por seguridad.

$msg = "";

// Definimos el ID de la persona a editar.

$id = htmlentities($_GET['id']);

// Si se apreta el boton Agendar, da la condicion como true.

if($_POST['editar'])

{

// Verificamos que no tengamos ningun dato sin rellenar.

if(!empty($_POST['nombre']) AND !empty($_POST['apellidos']) AND

!empty($_POST['correo']))

{

// Pasamos los datos de los POST a Variables, y le ponemos seguridad.

$nombre = htmlentities($_POST['nombre']);

$apellidos = htmlentities($_POST['apellidos']);

$correo = htmlentities($_POST['correo']);

$telefonofijo = htmlentities($_POST['telefonofijo']);

$telefonomovil = htmlentities($_POST['telefonomovil']);

$fax = htmlentities($_POST['fax']);

$pais = htmlentities($_POST['pais']);

$codigopostal = htmlentities($_POST['codigopostal']);

$direccion = htmlentities($_POST['direccion']);

$foto = htmlentities($_POST['foto']);

Page 16: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 15

$notas = htmlentities($_POST['notas']);

// Insertamos los datos en la base de datos, si da algun error lo muestra.

$sql = "UPDATE personas SET nombre='".$nombre."',

apellidos='".$apellidos."',correo='".$correo."',telefonofijo='".$telefonofijo."',telefonomovil=

'".$telefonomovil."',

fax='".$fax."',pais='".$pais."',codigopostal='".$codigopostal."',direccion='".$direccion."',

foto='".$foto."', notas='".$notas."' WHERE id='".$id."'";

mysql_query($sql,$link) or die(mysql_error());

// Mostramos un mensaje diciendo que todo salio como lo esperado

$msg = "Persona editada correctamente";

} else {

// Si hay un dato sin rellenar mostramos el siguiente texto.

$msg = "Falta rellenar algun dato importante. Recuerda que nombre

apellidos y correo son campos obligatorios";

}

}

// Mostramos los datos

$sql = "SELECT * FROM personas WHERE id='".$id."' LIMIT 1";

$query = mysql_query($sql,$link);

$row = mysql_fetch_assoc($query);

?>

<!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=utf-8" />

<title>Agenda - Editar personas</title>

</head>

<style type="text/css">

.agenda {

Page 17: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 16

margin:100px auto 0 auto;

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

<table width="100%" height="404" border="0">

<tr>

<td height="38" colspan="3" align="center" valign="middle"><h1>Editar

Persona</h1></td>

</tr>

<tr>

<td colspan="3" valign="top"><center><em><span

style="color:red;"><?=$msg;?></span></em></center>

<form action="editar.php?id=<?=$id?>" method="post" >

<strong>Nombre</strong><br />

<input type="text" name="nombre" id="nombre" />

<br />

<strong>Apellidos</strong>

<br />

Page 18: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 17

<input type="text" name="apellidos" id="apellidos" />

<br />

<strong>Correo electrónico</strong>

<br />

<input type="text" name="correo" id="correo" />

<br />

<strong>Teléfono fijo</strong>

<br />

<input type="text" name="telefonofijo" id="telefonofijo" />

<br />

<strong>Teléfono móvil</strong>

<br />

<input type="text" name="telefonomovil" id="telefonomovil" />

<br />

<strong>Fax</strong>

<br />

<input type="text" name="fax" id="fax" />

<br />

<strong>País</strong>

<br />

<input type="text" name="pais" id="pais" />

<br />

<strong>Código Postal</strong>

<br />

<input type="text" name="codigopostal" id="codigopostal" />

<br />

<strong>Dirección</strong><br />

Page 19: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 18

<input type="text" name="direccion" id="direccion" />

<br />

<strong>Link de la Foto</strong><br />

<input type="text" name="foto" id="foto" />

<br />

<strong>NOTAS</strong><br />

<input type="text" name="notas" id="notas" />

<br />

<input type="submit" name="editar" value="editar" />

</form>

</td>

</tr>

</table>

</div>

</div>

</body>

</html>

Page 20: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 19

BORRAR.PHP

Es el código que se va a encargar de borrar un usuario, requiriendo para ello, hacer una

confirmación.

<?php

// Incluimos la configuracion y conexion a la MySQL.

include('config.php');

// Definimos el ID de la persona a editar.

$id = htmlentities($_GET['id']);

// Si se apreta el boton Borrar, da la condicion como true.

if($_POST['borrar']){

$sql = "DELETE FROM personas WHERE id='".$id."'";

mysql_query($sql,$link) or die(mysql_error());

// Mostramos un mensaje diciendo que todo salio como lo esperado

printf ("Persona Borrada correctamente");

} else {

printf ("Tiene que confirmar que quiere borrar el USUARIO");

}

?>

<!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=utf-8" />

<title>Agenda - Borrar Usuario</title>

</head>

<style type="text/css">

.agenda {

margin:100px auto 0 auto;

Page 21: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 20

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

<table width="100%" height="404" border="0">

<tr>

<td height="38" colspan="3" align="center" valign="middle"><h1>Borrar

usuario</h1></td>

</tr>

<tr>

<center>

<form action="borrar.php?id=<?=$id?>" method="post" >

<input type="submit" name="borrar" value="borrar" />

</form>

</center>

</tr>

</table>

</div>

</div>

Page 22: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 21

</body>

</html>

Page 23: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 22

EDITARNOTAS.PHP

Es el código encargado de modificar las notas de un usuario.

<?php

// Incluimos la configuracion y conexion a la MySQL.

include('config.php');

// Definimos la variable $msg por seguridad.

$msg = "";

// Definimos el ID de la persona a editar.

$id = htmlentities($_GET['id']);

// Si se apreta el boton editarnotas, da la condicion como true.

if($_POST['editarnotas'])

{

// Verificamos hemos escrito algo en la nota.

if(!empty($_POST['notas']))

{

// Pasamos los datos de los POST a Variables, y le ponemos seguridad.

$notas = htmlentities($_POST['notas']);

// Insertamos los datos en la base de datos, si da algun error lo muestra.

$sql = "UPDATE personas SET notas='".$notas."' WHERE id='".$id."'";

mysql_query($sql,$link) or die(mysql_error());

// Mostramos un mensaje diciendo que todo salio como lo esperado

$msg = "nota editada correctamente";

} else {

// Si hay un dato sin rellenar mostramos el siguiente texto.

$msg = "Si quieres editar una nota, tienes que escribir algo

obligatoriamente";

}

}

Page 24: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 23

// Mostramos los datos

$sql = "SELECT * FROM personas WHERE id='".$id."' LIMIT 1";

$query = mysql_query($sql,$link);

$row = mysql_fetch_assoc($query);

?>

<!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=utf-8" />

<title>Agenda - Editar notas</title>

</head>

<style type="text/css">

.agenda {

margin:100px auto 0 auto;

width:841px;

height:561px;

background-image:url(imagenes/agenda.jpg);

}

.agenda #contenidor {

padding:25px;

width:276px;

height:428px;

}

</style>

<body>

<div class="agenda">

<div id="contenidor">

Page 25: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 24

<table width="100%" height="404" border="0">

<tr>

<td height="38" colspan="3" align="center" valign="middle"><h1>Editar

notas</h1></td>

</tr>

<tr>

<td colspan="3" valign="top"><center><em><span

style="color:red;"><?=$msg;?></span></em></center>

<form action="editarnotas.php?id=<?=$id?>" method="post" >

<strong>NOTAS</strong><br />

<input type="text" name="notas" id="notas" />

<br />

<input type="submit" name="editarnotas" value="editarnotas" />

</form>

</td>

</tr>

</table>

</div>

</div>

</body>

</html>

Page 26: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 25

FUNCIONAMIENTO DE LA AGENDA EN EL NAVEGADOR

PAGINA PRINCIPAL

Entramos en la agenda y vemos esto

Page 27: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 26

COMPROBANDO AGREGAR CONTACTOS

Cuando agregamos un contacto (agregar.php) se debe de comprobar que tanto el nombre

como los apellidos y el correos estén rellenados.

CUANDO FALTA EL NOMBRE

Page 28: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 27

CUANDO FALTA EL APELLIDO

Page 29: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 28

CUANDO FALTA EL CORREO

Page 30: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 29

CUANDO NO FALTA NADA

Page 31: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 30

COMPROBANDO EL BUSCADOR (buscar.php)

Page 32: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 31

COMPROBANDO LA SELECCIÓN DE USUARIOS, SU VISTA (ver.php)

Page 33: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 32

COMPROBANDO LA FUNCIÓN DE EDITAR DATOS (editar.php)

Page 34: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 33

COMPROBANDO EL BORRADO DE USUARIOS (borrar.php)

Page 35: Proyecto: Agenda de contactos en PHP

PROYECTO AGENDA[ ] 12 de diciembre de 2011

SEGUNDO DE ASIR Página 34

COMPROBANDO EL EDITADO DE NOTAS (editarnotas.php)