avky14 Posted December 15, 2016 Share Posted December 15, 2016 two actions in one forms <script type="text/javascript"> function submitTwice(form){ form.action = 'save.php'; form.submit(); form.action = 'https://www.paypal.com/cgi-bin/webscr'; form.submit(); } </script> i have need clear correct code in this script. i am entered details, first action save.php and second action paypal payment. This script only work in first action bt data not saved and second actions not worked. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted December 15, 2016 Share Posted December 15, 2016 If you want both actions to ALWAYS occur why not just let the first call to the script do them? Why are you using JS to do this when simple html will suffice here? Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted December 15, 2016 Share Posted December 15, 2016 After save.php processes the request, have you tried using a header redirect to go to PayPal? http://php.net/manual/en/function.header.php Quote Link to comment Share on other sites More sharing options...
avky14 Posted December 16, 2016 Author Share Posted December 16, 2016 I already used the header link but not use. i used sequence order the script move to paypal payment. But used header the first actions only worked and not save the database. And not move to paypal. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted December 16, 2016 Share Posted December 16, 2016 Your last post makes no sense at all. You "used the header link but not use"? Did you or didn't you "use" it? And you "used sequence order the script move". What does that mean. If you want to do two things when the form is submitted, then just DO THEM! You don't need to do another submit. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.