RE: [PHP] Forms & PHP
| From: | Gary Ogilvie | Date: | Wed, 02 Jul 2003 13:59:20 +0000 |
| Subject: | RE: [PHP] Forms & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153710@lists.php.net to get a copy of this message | ||
Ah I understand that - many thanks.
-----Original Message-----
From: Greg Wiley [mailto:greg@wileysworld.org]
Sent: 02 July 2003 14:59
To: Gary Ogilvie; 'PHP General'
Subject: Re: [PHP] Forms & PHP
On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie
<gary.ogilvie@wbpdata.com>
wrote:
> [snip]
> By maintaining the POST (assuming you're using POST)variables and
> calling them into the form values when reloaded. If you go to the
second
> page store the POST variables in hidden form input types, then grab
them
> when the second page is POSTED. Does this make sense? Not enough
> caffeine for me yet...[/snip]
>
> So basically I need to have 2 versions of the first page, is that
right?
> :)
>
>
No, in your first form you have code like
<?php
if ((!isset($_POST)) || (!isset($_POST['foo']))) {
$foo = <set default value here>;
} else {
$foo = $_POST['foo'];
}
?>
<form method="post" action="form2.php">
<input type="text" name=foo value="<?php echo $foo;?>" />
...
</form>
and in the second form you have:
<form method="post" action="form1.php">
<input type="hidden" name=foo value="<?php echo
$_POST['foo'];?>" />
...
</form>
Cheers, Greg.
--
Greg Wiley
www.wileysworld.org