• Resolved Anshuman

    (@likelylife)


    This is basically what I want:

    1. The form to be redirected to ‘Not Eligible’ page (webdcouple.ikowaguy.com/not-eligible/) when:
    – option 1 of question 3 is selected or
    – option 4 of question 5 is selected or
    – option 4 of question 6 is selected or
    – source of income is different than Employment and Self-Employment

    2. The form to be redirected to ‘Eligible’ page (webdcouple.ikowaguy.com/eligible/) in all other cases.

    This is the code I’ve used:

    add_filter('frm_redirect_url', 'return_page', 9, 3);
    function return_page($url, $form, $params){
      if($form->id == 2){ 
        $field_id = 10; //change 125 the the ID of the radio or dropdown field
        if($_POST['item_meta'][$field_id] == 'Less than 500') {
          $url = 'https://webdcouple.ikowaguy.com/not-eligible/';
        } 
    
     $field_id = 12; //change 125 the the ID of the radio or dropdown field
        if($_POST['item_meta'][$field_id] == 'Four or more') {
          $url = 'https://webdcouple.ikowaguy.com/not-eligible/';
    }
    
    $field_id = 37; //change 125 the the ID of the radio or dropdown field
        if($_POST['item_meta'][$field_id] == 'Four or more') {
          $url = 'https://webdcouple.ikowaguy.com/not-eligible/';
    }
    
    $field_id = 18; //change 125 the the ID of the radio or dropdown field
        if($_POST['item_meta'][$field_id] != 'Employment') {
          $url = 'https://webdcouple.ikowaguy.com/not-eligible/';
    }
    
    $field_id = 18; //change 125 the the ID of the radio or dropdown field
        if($_POST['item_meta'][$field_id] != 'Self-Employment') {
          $url = 'https://webdcouple.ikowaguy.com/not-eligible/';
    }
    
     else {
          $url = 'https://webdcouple.ikowaguy.com/eligible/'; 
        }
      }
      return $url;
    }
    

    The issue: The form is ALWAYS redirected to Not Eligible page no matter what option is selected. All the IDs of radio buttons are correct.

    What am I doing wrong? Please help!

    • This topic was modified 3 years, 6 months ago by Anshuman.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Njones35

    (@njones35)

    Hi @likelylife,

    Unfortunately, help with writing, customizing, and debugging custom code isn’t covered by our support. We don’t have a quick answer for this, and it would take quite a bit of development time to research and test it.

    We have had to make the hard decision that our limited development time is best spent on the things that will help the most people. As a result, we recommend more complex questions that are not documented go to Codeable or our supportive Slack Community group.
    https://formidableforms.com/join-slack/
    https://formidableforms.com/knowledgebase/how-to-get-custom-development-help-with-codeable/

    I hope you understand our policy on this, that custom code questions are not something we can feasibly support. I also hope that you won’t hold this against us.

    Best,

    Thread Starter Anshuman

    (@likelylife)

    Understood. I won’t hold this against you guys at all. I’ve asked the question in your Slack group.

    Thanks for the swift reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Redirect Not Working As Expected’ is closed to new replies.