1. INSTITUTO SUPERIOR
TECNOLOGICO UNITEK – IDAT
CARRERA PROFESIONAL DE
COMPUTACIÓN E INFORMÁTICA
DESARROLLO WEB PHP
Profesor: Pablo Cesar Tito
Tema: DOCUMENTACION
PAGINA WEB COLEGIO
Alumno:
Quispe Gutiérrez Jhon Elvis
AREQUIPA – PERÚ
2012
2. Inicio
La pagina principal permite el ingreso solo a usuarios logeados para poder administrar datos
almacenados en la base de datos de el colegio UTP en este caso el usuario es: jhon
Contraseña: jhon.
Menú
Esta pagina es el Menú principal donde escogerás la tarea que deseas ejecutar como
administrar o Consultar (Búsqueda).
3. Búsqueda
En la busqueda se tiene que ingresar ala informacion guia donde se pueda identificar al
alumno como datos con DNI, SEMESTRE, TURNO, ESPECIALIDAD.
Aquí muestra los datos buscados.
4. Insertar
Aquí se inserta los datos de los estudiantes llenando los campos requeridos en el sistema.
5. Actualización
Aquí al seleccionar al alumno puedes modificar la información insertada en la base de datos.
Aquí te muestra un formulario donde puedes modificar campos como Dni, Apellidos, Nombres
Email, Especialidad, Turno, Semestre.
6. Eliminar
En eliminar se tiene que seleccionar al alumno para poder eliminar de forma permanente
borrando todos los datos insertados.
11.
</div></td>
</tr>
</tr>
</table>
<center><imgsrc="inicio.png" width=440></center><br>
</center>
</body>
</html>
<?Php
}else{
?>
<script type="text/javascript">
window.alert("Usuario o Clave incorrecta")
</script>
<?Php
header("Location : index.php");
}
}else{
?>
<script type="text/javascript">
window.alert("Llene los campos")
</script>
<?Php
header("Location : index.php");
}
?>
Insertar
<?php
include("conexion.php");
$strDni=$_POST['txtDni'];
$strApellidos=$_POST['txtApellidos'];
$strNombres=$_POST['txtNombres'];
$strEmail=$_POST['txtEmail'];
$strEspecialidad=$_POST['cboEspecialidad'];
$strTurno=$_POST['cboTurno'];
$strSemestre=$_POST['cboSemestre'];
$conexion = mysql_connect($host, $user, $password) or die("Problemas con
Server");
mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la
base de datos
if(isset($strDni) && !empty($strDni) &&
isset($strApellidos) && !empty($strApellidos) &&
isset($strNombres) && !empty($strNombres) &&
isset($strEmail) && !empty($strEmail) &&
isset($strEspecialidad) && !empty($strEspecialidad) &&
isset($strTurno) && !empty($strTurno) &&
12. isset($strSemestre) && !empty($strSemestre))
{
$Sql="INSERT INTO Matriculas (Id, Dni, Apellidos, Nombres, Email,
Especialidad, Turno, Semestre)".
" VALUES (NULL, '$strDni', '$strApellidos', '$strNombres', '$strEmail',
'$strEspecialidad', '$strTurno', '$strSemestre')";
mysql_query($Sql);
header ("Location: listado.php");
}else{
?>
<script type="text/javascript">
window.alert("Es necesario que llene todos los campos")
</script>
<?Php
header("refresh:0; url = mostrar.php");
}
?>
Actualizar
<?php
include("conexion.php");
$Id=$_POST['txtId'];
$strDni=$_POST['txtDni'];
$strApellidos=$_POST['txtApellidos'];
$strNombres=$_POST['txtNombres'];
$strEmail=$_POST['txtEmail'];
$strEspecialidad=$_POST['txtEspecialidad'];
$strTurno=$_POST['txtTurno'];
$strSemestre=$_POST['txtSemestre'];
$conexion = mysql_connect($host, $user, $password) or die("Problemas con
Server");
mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la
base de datos
if(isset($strDni) && !empty($strDni) &&
isset($strApellidos) && !empty($strApellidos) &&
isset($strNombres) && !empty($strNombres) &&
isset($strEmail) && !empty($strEmail) &&
isset($strEspecialidad) && !empty($strEspecialidad) &&
isset($strTurno) && !empty($strTurno) &&
isset($strTurno) && !empty($strTurno))
{
$Sql="UPDATE MatriculasSET Dni='$strDni',
Apellidos='$strApellidos',
Nombres='$strNombres',
13. Email='$strEmail',
Especialidad='$strEspecialidad',
Turno='$strTurno',
Semestre='$strSemestre'
WHERE Id='$Id'";
mysql_query($Sql);
header ("Location: listado.php");
}else{
echo "Es necesario que llene todos los campos";
}
?>
Buscar
<?php
include("conexion.php");
$conexion = mysql_connect($host, $user, $password) or die("Problemas con
Server");
mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la
base de datos
$especialidad = $_POST["cboEspecialidad"];
$turno= $_POST['cboTurno'];
$semestre= $_POST['cboSemestre'];
$dni = $_POST['txtDni'];
$tabla = mysql_query("SELECT * FROM Matriculas WHERE Especialidad
=$especialidad "); // Selecciono todos los registros de la tabla
?>
<!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>Ubicacion</title>
</head>
<body bgcolor="black" text="orange">
<table width="800" border="0" align="center">
<tr>
<td colspan="5"><div align="center"><imgsrc="banner.jpg" width="800" height="250"
/></div></td>
</tr>
</table>
<div align="center">
<tr>
<td align="center" colspan=4><h1>Resultado</h1></td></tr>
<table border="1" width="700">
14. <tr align="center">
<td>Id</td>
<tdwidth="100">Dni</td>
<td>Apellidos y Nombres</td>
<td>Email</td>
</tr>
<?php
while ($Registro = mysql_fetch_array($tabla))
{
?>
<tr>
<td><?php echo $Registro['Id'];?></td>
<td><?php echo $Registro['Dni'];?></td>
<td><?php echo $Registro['Apellidos']." ". $Registro['Nombres'];?></td>
<td><?php echo $Registro['Email'];?></td>
</tr>
<?php
} // Fin del bucle de ordenes
mysql_free_result($tabla); // Libera los registros de la tabla
mysql_close($conexion); // Cierra la conexion con la base de datos
?>
</table>
</div>
</body>
</html>
Eliminar
<?php
include("conexion.php");
if(isset($_POST['chkRegistro']))
{
$valor=$_POST['chkRegistro'];
$conexion = mysql_connect($host, $user, $password) or
die("Problemas con Server");
mysql_select_db($db, $conexion) or die("Ploblemas con BD");//
Selecciona la base de datos
mysql_query("DELETE FROM Matriculas WHERE Id =$valor");
header ("Location: listado.php");
}else{
?>
<script type="text/javascript">
window.alert("Seleccione un Registro")
</script>
<?Php
header("refresh:0; url = listado.php");
}
?>
15. Listado
<?php
include("conexion.php");
$conexion = mysql_connect($host, $user, $password) or die("Problemas con Server");
mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la base de
datos
$tabla = mysql_query("SELECT * FROM Matriculas"); // Selecciono todos los registros
de la tabla
?>
<!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>Listado de Alumnos</title>
</head>
<body bgcolor="black" text="orange">
<table width="800" border="0" align="center">
<tr>
<td colspan="5"><div align="center"><imgsrc="banner.jpg" width="800" height="250"
/></div></td>
</tr>
</table>
<center>
<h1>Listado de Alumnos</h1>
</center>
<form id="MyForm" name="MyForm" method="post" action="">
<table align="Center" border="1" width="60%" cellspacing="0" cellpadding="2">
<tr align="center">
<td>Id</td>
<td>Dni</td>
<td>Apellidos</td>
<td>Nombres</td>
<td>Email</td>
<td>Especialidad </td>
<td>Turno</td>
<td>Semestre</td>
</tr>
<?php
while ($Registro = mysql_fetch_array($tabla))
{
?>
<tr>
<td>
<?php
$Id=$Registro['Id'];
16. echo "<input type='checkbox' id='chkRegistro' name='chkRegistro'
value='$Id'>";
echo $Registro['Id'];
?>
</td>
<td><?php echo $Registro['Dni'];?></td>
<td><?php echo $Registro['Apellidos'];?></td>
<td><?php echo $Registro['Nombres'];?></td>
<td><?php echo $Registro['Email'];?></td>
<td><?php echo $Registro['Especialidad'];?></td>
<td><?php echo $Registro['Turno'];?></td>
<td><?php echo $Registro['Semestre'];?></td>
</tr>
<?php
} // Fin del bucle de ordenes
mysql_free_result($tabla); // Libera los registros de la tabla
mysql_close($conexion); // Cierra la conexion con la base de datos
?>
</table>
<center>
<p>
<input type="button" onclick="this.form.action='mostrar.php' ;this.form.submit();"
name="btnInsertar" value="Insertar" />
<input type="button" onclick="this.form.action='consulta.php' ;this.form.submit();"
name="btnActualizar" value="Actualizar" />
<input type="button" onclick="this.form.action='eliminar.php' ;this.form.submit();"
name="btnEliminar" value="Eliminar" />
</p>
</center>
</form>
</body>
</html>
Mostrar
<!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>Documento sin título</title>
</head>
<body bgcolor="black" text="orange">
<table width="800" border="0" align="center">
<tr>
<td><div align="center"><imgsrc="banner.jpg" width="800" height="250" /></div></td>
</tr>