Re: Multiple forms
| From: | Tyler Longren | Date: | Mon, 30 Dec 2002 20:32:10 +0000 |
| Subject: | Re: Multiple forms | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129705@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Doug Coning" <lists@coning.com>
To: "php-general" <php-general@lists.php.net>
Sent: Monday, December 30, 2002 3:26 PM
Subject: [PHP] Multiple forms
> Hi all,
>
> I have an update page that has a form in it.
>
> However, I want to add another form in the same page. My current form
acts
> upon itself (i.e. Action = the same page). If I set up another form to do
> the same, how would my PHP determine with action submit button was acted
> upon?
>
> Currently, for the single form here is how it knows a form was submitted:
>
> if ((isset($HTTP_POST_VARS["MM_update"])) &&
> ($HTTP_POST_VARS["MM_update"]
> == "form1")) {
>
> How would I test which form submitted the action?
>
> Thanks and if I didn't make myself clear, I apologize.
>
> Doug
>
Hi Doug,
I handle it like this (I think):
Then, to process your form:
<?
if ($_POST[option] == "") {
// the form code should go here
}
else if ($_POST[option] == "form1") {
print "This will parse form1";
}
else if ($_POST[option] == "form2") {
print "This will parse form2";
}
?>
I haven't done this in a while though, so this may not work for you.
Good luck,
Tyler