Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/07/2009, 07:46
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 16 años, 7 meses
Puntos: 139
Respuesta: ejercicio 14 php ya "crear archivo de texto" donde fallo?

Hay muchos fallistos , desde el formulario ,hasta el codigo php
Aqui te pongo todo , comparalo .

Código HTML:
<html>
<head>
<title>Problema</title>
</head>
<body>
<form action="pagina2.php" method="post">
Su nombre:
<input type="text" name="nombre">
<br>
Su direcion:
<input type="text" name="direccion"> 
<br> 
Cuantas pizzas:
<input type="text" name="pizza">
<br>
Queso
<input type="checkbox" name="queso">
<br>
Chorizo
<input type="checkbox" name="chorizo">
<br>
Tomate
<input type="checkbox" name="tomate">
<br>
<input type="submit" name="enviar">
</form>
</body>
</html> 
Código PHP:

$ar
=fopen("datos.txt","a") or die("su peticion a fallado");
fputs($ar,$_REQUEST['nombre']);
fputs($ar,"\n");
fputs($ar,$_REQUEST['direccion']);
fputs($ar,"\n");
fputs($ar,$_REQUEST['pizza']);
fputs($ar,"\n");
if (isset(
$_REQUEST['queso']))
{
    
fputs($ar,"con queso");
    
fputs($ar,"\n");
}
if (isset(
$_REQUEST['chorizo'])) ## No estavas cerrando la funcion.
{
    
fputs($ar,"con chorizo");
    
fputs($ar,"\n");
}
if (isset(
$_REQUEST['tomate']))
{
    
fputs($ar,"con tomate");
    
fputs($ar,"\n");
}
fclose($ar);