When I manually enter data into some variables in a php file, either “positive” or “negative” text appears on the screen.
I want to execute data submitted from a form I created with the Gravity Forms plugin running in Wordpress, replacing it with variables from an external php file. With this query (POST or GET) running in the background, I want the form to be submitted or not based on the “positive” or “negative” response.
I would be grateful if you could assist me in this process.
While I’m not sure I’m understanding your question 100% correctly, I think there are a couple of hooks that should get you started:
Variables from a PHP file appearing on screen
You could use the code based dynamic population to put your variable into a field on the form.
Execute data submitted from a form…replacing it with variables from an external php file
The gform_after_submission action could let you replace values in the entry or do other processing based on the result. You would likely be using wp_remote_get (or wp_remote_post to make the additional call you describe.
But - that approach means that any notifications would be sent following the entry submission. You might want to use gform_validation to check the values before allowing the submission?
If the conditional logic is more complex, or you want to have visibility of when/why the different entries were actioned, deleted, etc. Gravity Flow and the steps/hooks it provides could make this a more elegant solution for you.
- All steps in a Gravity Flow workflow can have conditional logic (very similar to conditional logic for show/hide fields in the form) or use the gravityflow_is_condition_met filter for more complex cases like yours sounds to be.
- By default, you won’t be able to use gform_after_submission to delete the same entry that is being processed. The Gravity Flow Form Connector extension has a Delete an Entry Step Type that does by use of a separate cron scheduled job.
- If you need to do more complex processing, you can either use gravityflow_step_complete action or the custom step framework to easily create a unique activity. The latter gives you more flexibility to define custom step settings in addition to field values to conditionally complete that action or not.
Hope some of that helps you in your development process.
Thanks, that was a clear enough answer.