PHP Redirect Not Working As Expected
-
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-Employment2. 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!
The page I need help with: [log in to see the link]
- The topic ‘PHP Redirect Not Working As Expected’ is closed to new replies.