On Mon, 30 Dec 2002, Doug Coning wrote:

> 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?

Give your submit buttons names and values, then you can check the button
element's value as submitted and made available in $_POST.
i.e. -
In your HTML (notice the button /names/ are the same) :

<form name="form1" action="" method="POST">
  <input type="submit" name="submitButton" value="form1">
</form>

<form name="form2" action="" method="POST">
  <input type="submit" name="submitButton" value="form2">
</form>

And in your PHP:

if( $_POST['submitButton'] == "form1" ){
        // do something for form 1;
} elseif( $_POST['submitButton'] == "form2" ){
        // do something for form 2;
} else {
        // some tardnugget is playing games with your form ;)
}

There are several variations on this ... hope this one helps.

        g.luck,
        ~Chris



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

Reply via email to