Send form value between 3 pages
We are having a 3 page app where we should share email value from 1st page up to 3rd page
On a a 1st page we have form that has the email input and when we submit that form it is going to the second page (with "Go to page" option). Second page has other form. So we would like to send the email value as GET variable to second page/form.
On a second page we would like to display that email address and on submit to send it to the third page form where we would like to send a thank you email to the end user.
how can we do that?
Hello. Thank you for contacting the Toolset support.
CRED Does not natively support "multistep or multipage" forms. I would suggest that you should try to create different CRED forms for each step. For that you need to use CRED API hooks and requires some custom code.
I was able to set some hard-coded values to URL variable. The problem is that none of those examples/tutorials explains how to obtain value from CDER form and then assign it to URL variable. I want to get the value from email field "wpcf-tim-hortons-email" and assign it to URL variable tim-hortons-email here:
add_filter('cred_success_redirect', 'step2_redirect_func',10,3);
function step2_redirect_func($url, $post_id, $form_data)
{
if ($form_data['id']==7)
{
$arr = array('tim-hortons-email'=>wpcf-tim-hortons-email); //the step 2 CRED form post ID
$url = add_query_arg($arr, $url);
}
return $url;
}
For the first form option " Choose what this form will do:", choose "Create content",
For other forms choose "Edit content"'
Now, as your first form is set for "create content", you can easily get custom field value stored in database using WordPress function get_post_meta() and $post_id.
For example:
$email = get_post_meta($post_id,'wpcf-tim-hortons-email', true);
$arr = array('cred-edit-form'=>8,'tim-hortons-email'=>$email); //the step 2 CRED form post ID
$url = add_query_arg($arr, $url);
I hope this solution will help you to resolve your issue.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.