RE: [PHP] two submit buttons possible?
| From: | Cal Evans | Date: | Fri, 05 Jan 2001 17:13:55 +0000 |
| Subject: | RE: [PHP] two submit buttons possible? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32903@lists.php.net to get a copy of this message | ||
I'd use JavaScript and the onSubmit() of the form to redirect the action of
the form based on the button pressed.
Cal
-----Original Message-----
From: Geoff Coffey [mailto:gcoffey@wmotion.com]
Sent: Friday, January 05, 2001 10:45 AM
To: PHP General
Subject: Re: [PHP] two submit buttons possible?
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net