I need to add a form to my WordPress site that will post its data to an external API without ever storing the form data in the mysql database. I also need to show components of the response from the API to the user in the front end.

Right now I'm posting form data to the next page in the funnel, using wp_remote_post (at the top of this next page) to send the data to the API, and then either populating that page with data in response, or re-directing the user back to the previous page when API validation fails.

My big hurdles are re-populating data in the form when validation fails without the use of $_SESSION or mysql, and displaying data from the response without doing the same.

Will I get around any of the hurdles by posting the form to itself and then making use of wp_remote_post in the same page? Does it make more sense to make the call client-side via AJAX?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.