Re: [PHP 5.0] save HTML form to .php file
| From: | Németh Zoltán | Date: | Mon, 12 Feb 2007 10:10:21 +0000 |
| Subject: | Re: [PHP 5.0] save HTML form to .php file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248745@lists.php.net to get a copy of this message | ||
On h, 2007-02-12 at 21:04 +1100, Chris Henderson wrote:
> 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"
you have to store the data somewhere
- a DB
- a separate file
- or even you could rewrite the original "action.php" file but that
seems very messy to me
greets
Zoltán Németh
>
> 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.
>