benyates1 Posted August 21, 2014 Share Posted August 21, 2014 I have a multi-step form that offers different options of membership to users with the e-mail domain 'vip.co.uk' I finally have it working but have hit a wall with pulling the variables together to form an URL that can be submitted to the payment gateway in the final step. The variables I need to pass are username, password, email, subscription id (a value attached to a radio button in step 2 - not yet built it). I have a JS fiddle at http://jsfiddle.net/zsasvoo4/15/. The final form will be in PHP and I'd prefer to use that language. Quote Link to comment Share on other sites More sharing options...
Solution gristoi Posted August 21, 2014 Solution Share Posted August 21, 2014 I would say you shouldnt bother submitting it directly in php. use ajax in the $(".submit").click(function(){ $.ajax({ type:'POST', data: $('#joinform').serialize(), url: 'url to your backend php script / controller'' }); }) then in the backend just pull out the form vars $username = $_POST['username']; $pass = $_POST['pass']; //do your data santizing ..... //build a string and sent using curl / guzzle / http client $url = 'http://gatewayaddress?username='.$username.'&password='.$pass ........ etc Quote Link to comment Share on other sites More sharing options...
benyates1 Posted August 21, 2014 Author Share Posted August 21, 2014 I would say you shouldnt bother submitting it directly in php. use ajax in the $(".submit").click(function(){ $.ajax({ type:'POST', data: $('#joinform').serialize(), url: 'url to your backend php script / controller'' }); }) then in the backend just pull out the form vars $username = $_POST['username']; $pass = $_POST['pass']; //do your data santizing ..... //build a string and sent using curl / guzzle / http client $url = 'http://gatewayaddress?username='.$username.'&password='.$pass ........ etc Thanks for the response, its the building of the string I guess taht i'm having trouble with. I should have been clearer - I'm familiar with PHP variables and passing them in URLs. It's the taking of form fields and making them usable as parameters in an URL. 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.