Ver Mensaje Individual
  #8 (permalink)  
Antiguo 24/04/2013, 05:06
gamau6
 
Fecha de Ingreso: octubre-2010
Mensajes: 156
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Formulario PHP

si lo quieres en un solo archivo puedes hacerlo asi


Código PHP:
Ver original
  1. <?php
  2. if (isset($_POST) && !empty($_POST["juego"]) && !empty($_POST["nombre"]) && !empty($_POST["pueblo"]) &&
  3.  !empty($_POST["codigo"]) && !empty($_POST["estacion"]) && !empty($_POST["personaje"]) &&
  4.  !empty($_POST["frutas"]) && !empty($_POST["correo"])) {
  5.  
  6.     header("Content-type: image/jpeg");
  7.     $ju = trim($_POST["juego"]);
  8.     $no = trim($_POST["nombre"]);
  9.     $pu = trim($_POST["pueblo"]);
  10.     $co = trim($_POST["codigo"]);
  11.     $es = trim($_POST["estacion"]);
  12.     $pe = trim($_POST["personaje"]);
  13.     $fr = trim($_POST["frutas"]);
  14.     $cr = trim($_POST["correo"]);
  15.     $im = imagecreatefromjpeg("grid.jpg"); //cambia por la ruta de tu imagen
  16.     $blanco = imagecolorallocate($im, 255, 255, 255);
  17.     $negro = imagecolorallocate($im, 0, 0, 0);
  18.     imagestring($im, 5, 50, 20, "Animal Crossing: " . $ju, $blanco);
  19.     imagestring($im, 5, 50, 40, "Nombre: " . $no, $blanco);
  20.     imagestring($im, 5, 50, 60, "Pueblo: " . $pu, $blanco);
  21.     imagestring($im, 5, 50, 80, "Código de amigo: " . $co, $blanco);
  22.     imagestring($im, 5, 50, 100, "Estación favorita: " . $es, $blanco);
  23.     imagestring($im, 5, 50, 120, "Personaje favorito: " . $pe, $blanco);
  24.     imagestring($im, 5, 50, 140, "Frutas en el pueblo: " . $fr, $blanco);
  25.     imagestring($im, 5, 50, 160, "Correo electrónico: " . $cr, $blanco); //Aqui tenias $no y es $cr
  26.     imagepng($im);
  27.     imagedestroy($im);
  28. }
  29.  
  30.  
  31. ?>
  32.  
  33. <form name="frm" action="" method="post">
  34.     Animal Crossing: <input type="text" maxlength="35" name="juego" />
  35.     <br />Nombre: <input type="text" maxlength="35" name="nombre" />
  36.     <br />Pueblo: <input type="text" maxlength="35" name="pueblo" />
  37.     <br />Código de amigo: <input type="text" maxlength="35" name="codigo" />
  38.     <br />Estación favorita: <input type="text" maxlength="35"
  39.         name="estacion" /> <br />Personaje favorito: <input type="text"
  40.         maxlength="35" name="personaje" /> <br />Frutas en tu pueblo: <input
  41.         type="text" maxlength="35" name="frutas" /> <br />Correo
  42.     electrónico: <input type="text" maxlength="35" name="correo" /> <br />
  43.     <input type="submit" value="Obtener tarjeta" />
  44. </form>
__________________
..