Home › Forums › Quform WordPress › Conditionally redirecting the user to a different page (Multiple form)
- This topic has 1 reply, 2 voices, and was last updated 9 years, 10 months ago by Ally.
- AuthorPosts
- June 26, 2014 at 9:58 am #11602gsw85Participant
Hi, I go through the guideline and there is few error wish can found the solutions here:
I have two forms, with exactly the same field (different title), here are what I did, I added the following to the function.php
function mytheme_conditional_form_redirect($url, $form)
{
$selection = $form->getValue(‘iphorm_2_1’);switch ($selection) {
case ‘1’:
$url = ‘http://example.com/page1’;
break;
case ‘2’:
$url = ‘http://example.com/page2’;
break;
case ‘3’:
$url = ‘http://example.com/page3’;
break;
}return $url;
}
add_action(‘iphorm_success_redirect_url_2’, ‘mytheme_conditional_form_redirect’, 10, 2);function mytheme_conditional_form_redirect($url, $form)
{
$selection = $form->getValue(‘iphorm_3_1’);switch ($selection) {
case ‘1’:
$url = ‘http://example.com/page11’;
break;
case ‘2’:
$url = ‘http://example.com/page21’;
break;
case ‘3’:
$url = ‘http://example.com/page31’;
break;
}return $url;
}
add_action(‘iphorm_success_redirect_url_3’, ‘mytheme_conditional_form_redirect’, 10, 2);NOTE: Two script with different $url to redirect (form 2 1 and form 3 1)
However, after added these into the function.php, the website became blank (didn’t show anything), please let me know how to fix this, thanks!
June 27, 2014 at 4:56 pm #11611AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.