Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/03/2010, 03:04
DavidBL
 
Fecha de Ingreso: diciembre-2009
Ubicación: España
Mensajes: 380
Antigüedad: 14 años, 4 meses
Puntos: 1
Pregunta Ayuda nuevo en PHP

Hola queria preguntar una cosa.
Veran he hecho una prueba es poner el nombre y tu edad te dirige a otra página y funciona prefectamente con $_POST
Pero como puedo ponerlo todo en una página?
Codigo index.php
Cita:
<html><HEAD></HEAD><BODY>
<b>Tu nombre</b><form action="php.php" method="post">
<input type ="text" name="nombre">
Tu edad
<input type="text" name="edad">
<input type ="submit">
Y codigo php.php
Cita:
<html><head></Head><body>
<?php
$nombre=$_POST['nombre'];
$edad=$_POST['edad'];
echo "Tu nombre es $nombre y tienes $edad años";
?>
</body></html>
Mas o menos se que sería asi:
Cita:
<html><HEAD></HEAD><BODY>
<b>Tu nombre</b><form action="index.php" method="post">
<input type ="text" name="nombre">
Tu edad
<input type="text" name="edad">
<input type ="submit">
<?php
$nombre=$_POST['nombre'];
$edad=$_POST['edad'];
echo "Tu nombre es $nombre y tienes $edad años";
?>
</body>
</html>
y lo he probado, pero salen a lo primero 2 errores en pantalla, logico, antes de enviarlo, para que no salgan, como?