paulmason411
Posts: 127
|
| Posted: 07/16/2008, 12:15 AM |
|
Hi Guys,
I'm trying to use one button to preform two functions:
- Submit post variables to Paypal.
- Run some custom code to insert & remove data into the database
So the opening form tag goes like this:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
and then the the submit button has custom code attached at Server->On Click
When I test it out, the form submits to Paypal but doesn't run the custom On Click code.
Any ideas why this happens?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/16/2008, 9:27 AM |
|
Hi
It is associated with the fact that the client side code will run first on the page. The button does the form submit first and since the form URL is directed to paypal no CCS server side code executes.
I would suggest that have the submit button perform a CCS page submit setting some value to indicate that it is to run the paypal code from the server side in your on click event.
Does that make sense?
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
datadoit
|
| Posted: 07/16/2008, 11:38 AM |
|
JR has given an excellent reason why you were seeing what you're seeing.
Rather than posting directly to PayPal via the form, try to use cURL to
submit to the PP API and Name Value Pairs. PayPal provides working
PHP/cURL examples in the developer's area to get you started.
|
|
|
 |
jjrjr1
Posts: 942
|
| Posted: 07/16/2008, 12:22 PM |
|
Also,
You might consider taking a look at codecharge tools. They are pretty cheap and implement PayPal pretty well, along with other useful tools such as google maps etc...
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |