/    Sign up×
Community /Pin to ProfileBookmark

1 form, 2 actions? Or help with another solution…

[url]http://nlamreo.com/testing/vendorreg.html[/url]

What I need is for this form to submit AND take the user to the Paypal payment page (the Paypal button is showing at the bottom of the page, but I will remove it and ONLY use the “Proceed to Billing” button once this is figured out).

When I click submit, I not only need it to verify the required fields (which I’m working on seperately) but I *also* need it to perform the action to take the user to a Paypal payment page, shown in this code:

[CODE]
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_s-xclick”>
<input type=”hidden” name=”hosted_button_id” value=”8404079″>
<input type=”image” src=”https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!”>
<img alt=”” border=”0″ src=”https://www.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″>
</form>
[/CODE]

I tried redirecting the page to just go straight to the Paypal page, but I can’t get that to work either… but that would be fine if someone can tell me how to do that!

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscSep 23.2009 — To validate using JS, then add this to your form:

[code=html]
<form .... onsubmit="return verify();">
....
</form>
[/code]


JS:
<i>
</i>function verify() {
if(everythingsok) {
return true;
} else {
return false;
}
}


If you want to perform a server side validation (which is always a good idea because users can easily have JS turned off), then the only choice is to submit this form to a page on your server which validates it, asks the user to confirm the info is correct, and then make the verify button a submit button for a form with hidden fields that contain all the necessary information for PayPal.
×

Success!

Help @chausfeld spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...