Link to home
Start Free TrialLog in
Avatar of Jonathan Greenberg
Jonathan GreenbergFlag for United States of America

asked on

How to work with Ninja Forms user submitted values in WP

In my client's WordPress site, I have a web page with a form that's set up to redirect to another page.  I need to access the submitted form data from the redirect page, but the form values don't show up in a $_POST array on the redirect page.

Here's a Ninja Forms support page that I think provides instructions on how to achieve what I'm describing, but it's a bit over my head:

http://docs.ninjaforms.com/customer/portal/articles/1981023-processing-ninja_forms_processing

Do I need to add PHP to the form page?  To the redirect page?  Both?

I'd be grateful if someone who understands this page would have a look and tell me what I need to do to access the submitted form values from the redirect page.

Thanks!

Regards,
Jon
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

you realize that there is a ninja forms plugin for wordpress
https://en-ca.wordpress.org/plugins/ninja-forms/
Avatar of Jonathan Greenberg

ASKER

Yes, thank you, David, my site's Ninja Forms plugin is what I'm referring to.

The site has the Ninja Forms plugin installed. I need to know how to access the submitted form values from the page on the website that the user is redirected to after the form is submitted.
There were no useful answers.
Here's the solution that I discovered. It simply requires knowing the form number and the number of the field whose value is sought:

<?php
global $ninja_forms_processing;
if ( 5 == $ninja_forms_processing->get_form_ID( 5 ) ) {
	$user_value = $ninja_forms_processing->get_field_value( 18 );
	echo $user_value;
}
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jonathan Greenberg
Jonathan Greenberg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial