The GET Method
<?php
if( $_GET["name"] || $_GET["age"] )
{
echo "I am ". $_GET['name']. "<br />";
echo "I am ". $_GET['age']. " years old.";
exit();
}
?>
<html>
<body>
<form action="<?php $_PHP_SELF ?>" method="GET">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
The POST Method
<?php
if( $_POST["name"] || $_POST["age"] )
{
echo "I am ". $_POST['name']. "<br />";
echo "I am ". $_POST['age']. " years old.";
exit();
}
?>
<html>
<body>
<form action="<?php $_PHP_SELF ?>" method="POST">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
No comments:
Post a Comment