Jump to content

Archived

This topic is now archived and is closed to further replies.

onlyican

Double Action Form?

Recommended Posts

Hey
I have a form
What I want is a form on submit goes to my page, easy
<form method='post' action='mypage.php' target='_self'>

I also want on Submit to go to paypal

<form method='post action='www.paypal.com/full_link_here' target='_blank'>


NOW
I want One Form, One Submit but those 2 actions?
How could I do this?

Share this post


Link to post
Share on other sites
Well you can submit the form to mypage.php, then use cURL to sends the post'd data to paypal.

Share this post


Link to post
Share on other sites
[quote author=onlyican link=topic=103569.msg412501#msg412501 date=1155136334]
Hey
I have a form
What I want is a form on submit goes to my page, easy
<form method='post' action='mypage.php' target='_self'>

I also want on Submit to go to paypal

<form method='post action='www.paypal.com/full_link_here' target='_blank'>


NOW
I want One Form, One Submit but those 2 actions?
How could I do this?

[/quote]

After the form is submitted to "mypage.php," just place a header() command after the POST data is processed to redirect to the next site.

[code]
<?php
.....

header("Location: http://www.paypal.com/full_link_here?something={$_POST['arg1']}&somethingelse={$_POST['arg2']}");

.....
?>
[/code]

... or something like that.  You could use cURL, too, but that'd be more for situations where you wanted to pull data remotely from the page your accessing and then include it in your own page.  If that's what you're going for, then cURL is for you.  But if you just want to redirect to a different page, while saving the POST data from your original form, header() would do just fine.

Share this post


Link to post
Share on other sites
ok I can use GET method for paypal

But I need the 2 pages open
As the purpose is to confirm that the payment transaction is confirmed

So I can have the form like
[code]
<form method="post" action="pptest2.php">
<input type="text" name="email" value="email@domain.tld" /><br />
<input type="text" name="amount" value="4.99" /><br />
<input type="submit" value="Pay" />
</form>
[/code]

So how do I open a new page, without it being classed as a pop up

Share this post


Link to post
Share on other sites
As far as I know, if a pop-up is generated by the user clicking a link, the browser will not treat it as a possible advertisement.  You could also use an <iframe>, which I personally don't find visually appealing, but that's your perogative.  I'm sure that there are other options, like possibly providing the confirmation via e-mail in a printable format rather than in the browser window.

Share this post


Link to post
Share on other sites
The reason is, this script I am doing goes to paypal Send Money, with the form completed.
AND it goes to another page on my script to say Have you paid

I added a pop up. It is only admin who will need to use this page

Share this post


Link to post
Share on other sites
I'll have to check again, but I believe that PayPal provides an API if you want to develop your own shopping cart system, and have the confirmation generated on your page.  I know that Google does.  That'd be your best bet if you want to have a fully customized setup.

Share this post


Link to post
Share on other sites
I have set up the system with shopping cart ect

But I am building an affiliation script
So I was building a script where the admin can pay the affiliates
They way it is set up, the form in dyanmicly generated hidden. On click this will open paypals "Send Money" tab, with the email address and amount set up

But for security I cant pay and  check payment, so the 2nd page is for the admin to click when the payment is confirmed

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.