On Wed, 02 Jul 2003 14:58:39 +0100, Greg Wiley <[EMAIL PROTECTED]> wrote:

On Wed, 2 Jul 2003 14:45:27 +0100, Gary Ogilvie <[EMAIL PROTECTED]> 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

Well almost. I realised whilst trying to get to sleep last night that there's a problem with this. In the first form you need:

<?php
if ((!isset($_POST)) || (!isset($_POST['foo']))) {
        $foo = <set default value here>;
$action = "form2.php";
} else {
        $foo = $_POST['foo'];
$action = "results.php";
}
?>

<form method="post" action="<?php echo $action;?>">
<input type="text" name=foo value="<?php echo $foo;?>" />
...
</form>

This way you won't get a circular dependency. However, it means that you'll need to provide some other way of amending the details on form2 if it's a requirement.

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


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to