Re: two submit buttons possible?
| From: | Geoff Coffey | Date: | Fri, 05 Jan 2001 16:44:44 +0000 |
| Subject: | Re: two submit buttons possible? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32899@lists.php.net to get a copy of this message | ||
on 1/5/01 9:37 AM, Tom Beidler at tbeidler@mindspring.com wrote:
> I'm wondering if there is a way in PHP to have two submit buttons on a form.
> One directs to one page, the other to another page.
>
> I have a checkout process that has two options, one for credit card users
> that needs to be secure, the other uses a dealer id which doesn't need to be
> secure.
>
> The ISP we are working with can't get SSL and PHP on the same daemon. Most
> orders do not be secure so I can use PHP to fill in most of the form for
> them using PHP and MySQL. If they need to be secure I can't use PHP and
> there by cannot fill out the form ( unless there is some way to pass the
> variables from a PHP page to a vanilla html page?).
>
> Any assistance would be greatly appreciated.
With javascript, you could have the buttons submit one of two hidden forms,
each of which goes to a different php script (action=...)...but there's
probably a better way.
Just put two submit buttons on your form with different values (labels) and
the same name. On the PHP side, you can check which button was clicked
because it's value will be the value of the variable associated with the
submit button...does that make sense? Submit buttons are kind of like
one-shot radio buttons...the one you click sends it's value back with the
form...
Hope this helps,
Geoff