Forms: Is it possible to have two different action?

J

Jason Henning

I'm doing a web site that has a shopping cart. Once the shopper is
finished, I want to gather their name, email and phone number. Then I
want the shopper to either choose to pay with paypal or to pay when
they come to pick up the order.

I guess what I'm saying is I want to be able to gather data and let
the shopper choose where it's sent.

Now I kow i can solve this problem with two pages but I'd like to make
it one page if I can. I also know I can do it in one page if i make
two forms but I don't want to do that either. Is there a solution?

Here's what I'd like html do but of course it doesn't work this way:

<form>

Your Name <input type='text' name='name'>
<br>
Your email address <input type='text' name='eaddy'>
<br>
Your phone number <input type='text' name='phone'>

<input type='submit' value='Pay at pick up' action='send_order.php'
method='post'>

<input type='submit' value='Send order to PayPal'
action='http://paypal.com' method='post'>

<input type='reset'>

</form>


----------------------

Thanks for any insight.

Cheers,
Jason Henning
 
M

Mark Parnell

Now I kow i can solve this problem with two pages but I'd like to make
it one page if I can. I also know I can do it in one page if i make
two forms but I don't want to do that either. Is there a solution?

Give them radio buttons for the 2 payment options, and have your script
act accordingly depending on which one is selected.
 
J

Jason Henning

Give them radio buttons for the 2 payment options, and have your script
act accordingly depending on which one is selected.

When they select PayPal, I want the data to go to paypal, not another
one of my scripts. If both actions were under my domain, your solution
works fine.

However...

I don't know PHP well enough yet but maybe there is a why for it to
evaluate the radio buttons and then go to paypal without doing another
page from my domain. I know this isn't a PHP but does that sound
possible?

Thanks again.

Cheers,
Jason Henning
 
R

Richard

Jason said:
I'm doing a web site that has a shopping cart. Once the shopper is
finished, I want to gather their name, email and phone number. Then I
want the shopper to either choose to pay with paypal or to pay when
they come to pick up the order.
I guess what I'm saying is I want to be able to gather data and let
the shopper choose where it's sent.
Now I kow i can solve this problem with two pages but I'd like to make
it one page if I can. I also know I can do it in one page if i make
two forms but I don't want to do that either. Is there a solution?

Why not let the user choose first?
Choose paypal.......send to paypal page collect data.
Choose pickup......send to pickup page which will collect data not needed
for paypal.
Why would you need their paypal account information for instore pick up?
 
M

Mark Parnell

I don't know PHP well enough yet but maybe there is a why for it to
evaluate the radio buttons and then go to paypal without doing another
page from my domain. I know this isn't a PHP but does that sound
possible?

Sure, why not?

Your script should:

1) Get the information from the form
2) Make sure the form was filled in correctly
3) If it was, check which payment method was selected
4) Depending on the answer to 3), forward them to either your page or
forward the information to the relevant Paypal page

I don't know much about PHP either, but I wouldn't think it would be
that hard. You're just sending them to another site instead of another
page on your site.
 
J

Jason Henning

Why not let the user choose first?
Choose paypal.......send to paypal page collect data.
Choose pickup......send to pickup page which will collect data not needed
for paypal.

Well yeah, I said earlier I could do that. I just wanted to see if it
could be done with one page. It's more of a learning thing than a
requirement. It's part of my geekdum, I'm hardwired to pound screws
with a hammer.
Why would you need their paypal account information for instore pick up?

I don't want info specific to their paypal account. I want to send
info to paypal that gets bounced back to my conformation page. One of
the shortcomings of paypal's system is I can't send a note from our
site to be included in the order.

This isn't your normal 9-5 business. They sell from their storefront,
at the Farmers' Market, they deliver to club meetings (as well as
special deliveries if you happen to live on their way home). With
paypal, I can't put where the order is to be picked up.

Once an order is processed through paypal, you can have paypal send
them to a URL of your choice. My URL would be like this:

soemsite.com/pp_completed.php?name=bill+jones&delivery=FM

I left out data for email and phone number so that url would be easier
to read. When they get returned to that page, they would see a nice
conformation page and an email would be sent to us with Bill Jones's
delivery preference, the Farmers' Market, and his contact info.

The pick-up location is the only reason I'm sending anything other
than the total to paypal.


Cheers,
Jason Henning
 
H

Hywel Jenkins

Jason Henning said:
When they select PayPal, I want the data to go to paypal, not another
one of my scripts. If both actions were under my domain, your solution
works fine.

That's fine. Have your script redirect PayPal selections to the
PayPal service with a populated GET url; redirect non-PayPal users to
another screen. Download the PHP docs (http://www.php.net/) and look
up "header". You'll need 6 lines of code, including the PHP markers
<? and ?>.
 
W

Whitecrest


Well if he is having a problem thinking out side of the box, then
getting a bigger box would not help, they need a smaller box, then they
could get out of it easier.

Come one, work with me here...
 
R

Richard

Jason Henning wrote:

Well yeah, I said earlier I could do that. I just wanted to see if it
could be done with one page. It's more of a learning thing than a
requirement. It's part of my geekdum, I'm hardwired to pound screws
with a hammer.
I don't want info specific to their paypal account. I want to send
info to paypal that gets bounced back to my conformation page. One of
the shortcomings of paypal's system is I can't send a note from our
site to be included in the order.
This isn't your normal 9-5 business. They sell from their storefront,
at the Farmers' Market, they deliver to club meetings (as well as
special deliveries if you happen to live on their way home). With
paypal, I can't put where the order is to be picked up.
Once an order is processed through paypal, you can have paypal send
them to a URL of your choice. My URL would be like this:

I left out data for email and phone number so that url would be easier
to read. When they get returned to that page, they would see a nice
conformation page and an email would be sent to us with Bill Jones's
delivery preference, the Farmers' Market, and his contact info.
The pick-up location is the only reason I'm sending anything other
than the total to paypal.

Cheers,
Jason Henning

Then what you should do is contact paypal, explain the situation, and see if
they can include something for your unique request.

All it would take is a few lines of code on their part.

Quite frankly, I'd find another method of accepting payment on line outside
of paypal.

How'd you wind up with a "henry j"?

I pulled into a truckstop one day, parked beside a flat bed that had two old
cars on it.
Couldn't figure out what they were so I had to get out and look.
Turned out both were '54 kaiser manhattan's.
 
R

rf

Well if he is having a problem thinking out side of the box, then
getting a bigger box would not help, they need a smaller box, then they
could get out of it easier.
Come one, work with me here...

Ah, Gotya. Just like the best way to convince a programmer to do something
is to suggest it can't be done :)

Cheers
Richard.
 
J

Jason Henning

Quite frankly, I'd find another method of accepting payment on line outside
of paypal.

I lobbied hard for a merchant account but they wanted to stick with
paypal. I could really lay down a nasty paypal rant but this isn't the
place.
How'd you wind up with a "henry j"?

Bad luck. It was my Greatgrand fathers. My Grandpa had it after the
g-grands past. When my Grandmother passed, my Mom and uncles gave it
to me.

I say bad luck because auto restoration isn't really anythting I'm
interested. And it's expensive!
I pulled into a truckstop one day, parked beside a flat bed that had two old
cars on it.
Couldn't figure out what they were so I had to get out and look.
Turned out both were '54 kaiser manhattan's.

Want to see more Kaiser or Fraziers? Check out:
http://www.classiccar.com/photopost/showgallery.php?cat=584&password=&page=
or http://tinyurl.com/39dvs

Cheers,
Jason Henning
 
J

Jason Henning

Well if he is having a problem thinking out side of the box, then
getting a bigger box would not help, they need a smaller box, then they
could get out of it easier.

Come one, work with me here...


This begs the question. If you are constantly thinking outside the
box, doesn't the outside eventually become the inside?

And why do we drive on a parkway and... oh, never mind.

Cheers,
Jason Henning
 
D

Duende

While sitting in a puddle Jason Henning scribbled in the mud:
Want to see more Kaiser or Fraziers? Check out:

I had a 1948 Kaiser. The thing was built like a tank. To bad a wheel came
off when I was ripping along at about 40 mph. That poor ditch didn't have a
chance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top