PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
So I have a simple form (attached) with Terms and conditions (with tick box to agree before continuing) and a button called ‘Submit'. When the terms have been agreed and the button clicked, I want to pull data from my WordPress member data on a MYSQL db and submit this data to another website member form (I will add several websites around the world which will no doubt have varying membership form data requirements). Then return a result page saying: “We are activating this and you will be receiving info shortly. Blah…
What's the best way/How would you do it in PHP? Does anyone have or can anyone come up with the best code to use for this? I'd like to test it.
Cheers.
Attachments
Screen Shot 2016-06-06 at 12.36.12.png (18.1 KiB) Viewed 3915 times
Probably the best way is to simulate the form submission using something like cURL - you do it on the backend, not with an actual form on the frontend.
cURL is fairly simple to use. You just set a number of options for what you want to do: option to GET or POST, option to include form data, option to return whatever response the other server says (because it outputs by default)... The basic example that shows what the code looks like, and all the options are documented with curl_setopt. Also check the user comments to see what other people have said about it.