[PHP 5.0] save HTML form to .php file
| From: | Chris Henderson | Date: | Mon, 12 Feb 2007 10:04:04 +0000 |
| Subject: | [PHP 5.0] save HTML form to .php file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248744@lists.php.net to get a copy of this message | ||
My HTML form submits data to a php form and the php form displays it.
I was wondering if I could "save" the data in the php form so whoever
opens it can see the data. At the moment, if I open "action.php" from
a different computer or browser I see "hi you are 0 years old"
Here's my HTML & PHP form -
<html>
<head> </head>
<title> Form </title>
<body>
<form action="action.php" method="post">
<p> your name: <input type="text" name="name" /> </p>
<p> your age: <input type="text" name="age" /> </p>
<p> <input type="submit" /> </p>
</form>
</body>
</html>
PHP form -
hi <?php echo htmlspecialchars($_POST['name']); ?>
you are <?php echo (int)$_POST['age']; ?> years old
Thanks.