0

I want to create a paypal form with two actions .. mainreason for it is to save an entry in database

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
// extra value to save in database
<input type="hidden" name="data1" value="value1">

I have read a lot about to do this with javascript but i want to prevent misses when javascript is disabled

i need a solution to save the entrys in database before it leave page and go to the paypal site

any solution ?

kind regards

Dave
  • 27
  • 10
  • As you state it: You want to have two actions within one form, which is not possible without JS. What you can do is: First define the action to be targeted at your server , get the extra value and than forward / redirect the request to https://www.paypal.com/cgi-bin/webscr. – Peter Jan 16 '15 at 20:59
  • possible duplicate of [Submit form via cURL and redirect browser to PayPal](http://stackoverflow.com/questions/14843212/submit-form-via-curl-and-redirect-browser-to-paypal) – Len_D Jan 16 '15 at 21:03

1 Answers1

0

JavaScript: You can have onclick function to the submission then using javascript do an Ajax call to some PHP file that insert row to the DB; then with success call direct to the paypal site.

Non-Javascript: You can use php to do header location. So change the form action to some php file that first insert row to the database then with Header(location) redirect to paypal site. http://php.net/manual/en/function.header.php