Home › Forums › Quform WordPress › Redirect depending on checkbox selected
- This topic has 1 reply, 2 voices, and was last updated 9 years, 8 months ago by Ally.
- AuthorPosts
- August 22, 2014 at 1:22 pm #12255KranzyParticipant
Hi,
I am wanting to redirect to certain pages depending on the results of the submitted form.
For the most part it is working, however I cannot seem to get it to work with my checkboxes.
What is the correct syntax to check if the option ‘None of the above’ is selected?
This is what i have so far…
<?php
function mytheme_conditional_form_redirect($url, $form)
{
$selectionQ3 = $form->getValue('iphorm_1_3'); //multiple choice
$selectionQ5 = $form->getValue('iphorm_1_5'); //multiple choice
$selectionQ6 = $form->getValue('iphorm_1_6'); //multiple choice
$selectionQ9 = $form->getValue('iphorm_1_9'); //multiple choice
$selectionQ10 = $form->getValue('iphorm_1_10'); //multiple choice
$selectionQ11 = $form->getValue('iphorm_1_11'); //multiple choice
$selectionQ12 = $form->getValue('iphorm_1_12'); //checkboxes
$selectionQ12b = $form->getValue('iphorm_1_14'); // checkboxesif($selectionQ5 || $selectionQ6 == 'Yes'){
$url = 'http://address.com.au/results_a';
}
elseif($selectionQ9 == 'Yes'){
$url = 'http://address.com.au/results_b';
}
elseif(($selectionQ10 == 'No') && ($selectionQ12 == 'None of the above')){
$url = 'http://address.com.au/results_c';
}
elseif($selectionQ10 == 'Yes'){
$url = 'http://address.com.au/results_d';
}
elseif($selectionQ12 || $selectionQ12b != 'None of the above'){
$url = 'http://address.com.au/results_e';
}
elseif($selectionQ3 == 'Yes' && $selectionQ12 == 'None of the above'){
$url = 'http://address.com.au/results_f';
}
else{
$url = 'http://address.com.au/';
}return $url;
}
add_action('iphorm_success_redirect_url_1', 'mytheme_conditional_form_redirect', 10, 2);?>
August 23, 2014 at 2:54 pm #12264AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 9 years, 8 months ago by Ally.
- AuthorPosts
- You must be logged in to reply to this topic.