1. UNIVERSIDAD TECNOLÓGICA DEL ESTADO DE ZACATECAS
UNIDAD ACADÉMICA DE PINOS
TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
Materia
Desarrollo de aplicaciones II
Tema
Manejo de archivos
Nombre completo del Alumno: Ana Francisca Martínez Betancourt, José de Jesús
Cisneros Morales.
Grado: 4 Grupo: B
Nombre del Docente: I.Tic. Eloy Contreras de Lira
Lugar: Pinos, Zacatecas
Fecha de entrega : 09 Octubre 2013
2. UNIVERSIDAD TECNOLÓGICA DEL ESTADO DE ZACATECAS
UNIDAD ACADÉMICA DE PINOS
TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
Formulario INDEX.php
<!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>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="escritura.php">
</form>
<form id="form2" name="form2" method="post" action="">
<p>
<label for="Nombre">Nombre</label>
<input type="text" name="Nombre" id="Nombre" />
</p>
<p>
<label for="Apellidos">Apellidos</label>
<input type="text" name="Apellidos" id="Apellidos" />
</p>
3. UNIVERSIDAD TECNOLÓGICA DEL ESTADO DE ZACATECAS
UNIDAD ACADÉMICA DE PINOS
TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
<p>
<label for="Matricula">Matricula</label>
<input type="text" name="Matricula" id="Matricula" />
</p>
<p>
<label for="Carrera">Carrera</label>
<input type="text" name="Carrera" id="Carrera" />
</p>
<p>
<input type="submit" name="Guardar" id="Guardar"
value="Guardar" />
</p>
</form>
<?php
$fp=fopen("archivo.txt","r");
while(!feof($fp)){
echo fgets($fp)."<br/>";
}
fclose($fp);
?>
</body>
</html>
4. UNIVERSIDAD TECNOLÓGICA DEL ESTADO DE ZACATECAS
UNIDAD ACADÉMICA DE PINOS
TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
Leer el archivo
<?php
$fp=fopen("archivo.txt","r");
while(!feof($fp)){
echo fgets($fp)."<br/>";
}
fclose($fp);
?>
Escribir el archivo Escritura.php
<?php
$Nombre=$_POST['Nombre'];
$Apellidos=$_POST['Apellidos'];
$Matricula=$_POST['Matricula'];
$Carrera=$_POST['Carrera'];
$linea=$Nombre."t".$Apellidos."t".$Matricula."t".$Carrera."n";
$fp=fopen("archivo.txt","a");
fputs($fp,$linea);
fclose($fp);
?>
5. UNIVERSIDAD TECNOLÓGICA DEL ESTADO DE ZACATECAS
UNIDAD ACADÉMICA DE PINOS
TECNOLOGÍAS DE LA INFORMACIÓN Y COMUNICACIÓN
Index