RE: [PHP] determine action of a form dynamically?
| From: | Jon Haworth | Date: | Tue, 03 Jun 2003 09:59:54 +0000 |
| Subject: | RE: [PHP] determine action of a form dynamically? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149913@lists.php.net to get a copy of this message | ||
Hi Mukta,
> I want action of a form to be PHP_SELF untill user
> presses "continue" button. If continue button is
> pressed than "next.php" should be the action of the
> form. how to do this?
One way would be to have two buttons in your form, but submit to only one
page:
<form action="process.php">
<input type="submit" name="op" value="Continue">
<input type="submit" name="op" value="Stop">
</form>
... and then, on process.php, you decide what to do:
if ($_GET["op"] == "Continue") {
// do continuation stuff, or redirect somewhere
} elseif ($_GET["op"] == "Stop") {
// do stopping stuff, or redirect somewhere
} else {
// handle gracefully
}
Cheers
Jon