RE: [PHP] Multiple forms
| From: | John W. Holmes | Date: | Mon, 30 Dec 2002 20:34:11 +0000 |
| Subject: | RE: [PHP] Multiple forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129707@lists.php.net to get a copy of this message | ||
> 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.
Just name each submit button something different. The program could
check for $_POST['MM_update'] to process the first form, or
$_POST['MM_update2'] to update the second.
<input type="submit" name="MM_update" value="Submit">
<input type="submit" name="MM_update2" value="Submit">
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/