Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2008, 00:59
alpino
 
Fecha de Ingreso: febrero-2008
Mensajes: 1
Antigüedad: 16 años, 3 meses
Puntos: 0
construir tabla a partit de archivotexto

Soy muy novato en esto y no encuentro la manera de llevarme losdatos de un archivo de texto en el que los datos están así:

hombre
6-12
Estudiante
Ninguno
no
si
si
ENVIAR
mujer
12-16
Trabajador/a por cuenta propia
Primaria
sobremesa
no
no
ENVIAR

a una tabla. Lo más que consigo con este script es escribir los primeros datos pero me lio con el puntero y no se incluir más registros. ¿Alguien tiene alguna idea?.
Gracias.
<html>
<head>
<title>tabla</title>
</head>
<body>
<br>
<br>
<br>
<?
$var=file("escribiente.txt");
?>
<table width="100%" border="1" cellspacing="1" cellpadding="0">
<tr>
<th>sexo</th>
<th>edad</th>
<th>profesión</th>
<th>estudios</th>
<th>ordenador</th>
<th>conexión</th>
<th>trabaja en casa</th>
</tr>
<tr>
<td><? for($j=0;$j<10;$j++) {
echo $var[0][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[1][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[2][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[3][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[4][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[5][$j];
}
?> </td>
<td> <? for($j=0;$j<10;$j++) {
echo $var[6][$j];
}
?></tr>
</table>
</body>
</html>