Jump to content

Double Action Form?


onlyican

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?
Link to comment
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.
Link to comment
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
Link to comment
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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.