Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/03/2010, 09:04
JavierRo
 
Fecha de Ingreso: marzo-2010
Mensajes: 3
Antigüedad: 14 años, 1 mes
Puntos: 0
Problemas con firefox.

Hola a todos, escribo aqui para plantear un problema que se me esta presentando con firefox. Estaba leyendo un manual de PHP y me encontre con un código básico para imprimir por pantalla todos los datos almacenados en una variable GET. Al probarlo me corrió tanto en IE como en Opera, pero en en firefox me presenta un error. El código es el siguiente:

<!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>
<p>Introduzca sus datos personales : </p>
<form name="formulario" method="GET" action="formulario2.php" >
<table width="50%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="24%">Nombre</td>
<td width="76%" ><input name="nombre" type="text" id="nombre"x/></td>
</tr>
<tr>
<td>Apellidos</td>
<td><input name="apellidos" type="text" id="apellidos2" x/></td>
</tr>
<tr>
<td>Correo</td>
<td><input name="correo" type="text" id= "correo" x/></td>
</tr>
<tr>
<td>Estado civil </td>
<td><select name= "estado" id= "estado" >
<option value="Soltero">Soltero</option>
<option value="Casado">Casado</option>
<option value="Divorciado">Divorciado</option>
<option value="Viudo">Viudo</option>
</select></td>
</tr>
<tr>
<td>N&uacute;mero hijos </td>
<td> 0 <input name="hijos" type="radio" value="0" checked>
1 <input name="hijos" type="radio" value="l">
2 <input name="hijos" type="radio" value="2">
3 <input name="hijos" type="radio" value="3"></td>
</tr>
<tr>
<td>Gustos</td>
<td> Inform&aacute;tica <input type="checkbox" name="gustos[]"
value="Informática">
Buceo <input type="checkbox" name="gustos[] " value="Buceo">
Magia <input type="checkbox" name="gustos[] " value="Magia">
Jazz <input type="checkbox" name="gustos[] " value="Jazz"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Enviar"></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
<p>&nbsp; </p>
</body>
</html>

<!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>
<p>Datos introducidos : </p>
<?php
foreach ($_GET as $indice => $valor) {
echo "$indice: $valor<br>" ;
}
echo "<br>GUSTOS:<br>";
$gustos = $_GET["gustos"];
foreach ($gustos as $indice => $valor) {
echo "$indice: $valor<br>";
}
?>
</body>
</html>

Al probar este codigo en firefox me presenta lo siguiente:

Datos introducidos :
$valor) { echo "$indice: $valor
" ; } echo "
GUSTOS:
"; $gustos = $_GET["gustos"]; foreach ($gustos as $indice => $valor) { echo "$indice: $valor
"; } ?>

Quisiera saber por que sucede esto. Sin mas que decir Gracias por su Ayuda