Conditionally redirecting the user to a different page (Multiple form)

Home Forums Quform WordPress Conditionally redirecting the user to a different page (Multiple form)

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11602
    gsw85
    Participant

    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!

    #11611
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy