Submitting Form entry data to process using Python Script

By: Henry King | Asked: 07/03/2022
ForumsCategory: How-toSubmitting Form entry data to process using Python Script
Henry King asked 2 years ago
Hi I need to submit Formidable Form entry data (e.g. Age and Value) to my Python script for some complex calculations before returning the results to be displayed in the same Wordpress page containing the Form.  I gave a simple sample below of what the page with the Formidable Form will look like. Sample page containing Form at the top and result to be displayed. Age: 32 Value: 1000 Calculate (Submit) button ________________________ Result: [to be returned after processing using Python Script]    
Question Tags:
1 Answers
Victor Font answered 2 years ago

As a WordPress plugin, Formidable is written in PHP. You can pass values to Python using a Hook or through Ajax and feed the new values back to Formidable. See this stackoverflow question about executing Python scripts from PHP: https://stackoverflow.com/questions/19735250/running-a-python-script-from-php. One thing to be aware of is that many hosts disable PHP exec() because it can be used to breach server security.

Henry King replied 2 years ago

Hi
Appreciate your help. I am wondering instead of using Hook, can I use REST API?
What are the conditions that I can use REST API?
Thanks in advance.

Victor Font replied 2 years ago

You use the REST API when you're moving data to and from a REST endpoint. REST endpoints are web based. Python is a server platform, not REST.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right