Home › Forums › Quform WordPress › REDIRECT URL BASED ON SELECT DATA
- This topic has 3 replies, 2 voices, and was last updated 3 years, 8 months ago by linux.
- AuthorPosts
- March 10, 2021 at 12:24 am #32635linuxParticipant
Hello,
I use codes below to redirect based on select data from radio button element ID 1_6 and form ID is 1.
I put the code in custom plugin called quform-custom-code. I follow guide https://support.themecatcher.net/quform-wordpress-v2/guides/advanced/creating-a-plugin-for-custom-code.
But redirect not working. Please help.
<?php
/*
* Plugin Name: Quform Custom Code
* Description: Custom code for Quform.
* Version: 1.0
*/// REDIRECT
function my_conditional_form_redirect($url, $form)
{
$selection = $form->getValueText(‘quform_1_6’);switch ($selection) {
case ‘ToT BTCLS’:
$url = ‘https://tinyurl.com/xxx1’;
break;
case ‘ACLS’:
$url = ‘https://tinyurl.com/xxx2’;
break;
case ‘GELS’:
$url = ‘https://s.id/xxx3’;
break;
case ‘ALTEM’:
$url = ‘https://s.id/xxx4’;
break;
case ‘PPI DASAR’:
$url = ‘https://s.id/xxx5’;
break;
case ‘PECCAMVID’:
$url = ‘https://s.id/xxx6’;
break;
case ‘VAKSINATOR’:
$url = ‘https://s.id/xxx7’;
break;
}return $url;
}
add_action(‘quform_confirmation_redirect_url_1’, ‘my_conditional_form_redirect’, 10, 2);- This topic was modified 3 years, 8 months ago by linux.
March 10, 2021 at 4:53 am #32637linuxParticipantI change codes to below. Data submitted but the page not redirect
add_filter(‘quform_confirmation_redirect_url_1_1’, function ($url, Quform_Confirmation $confirmation, Quform_Form $form) {
$selection = $form->getValueText(‘quform_1_6’);
switch ($selection) {
case ‘ToT BTCLS’:
$url = ‘https://tinyurl.com/xxxxx1’;
break;
case ‘ACLS’:
$url = ‘https://tinyurl.com/xxxxx2’;
break;
case ‘GELS’:
$url = ‘https://s.id/xxxxx3’;
break;
case ‘ALTEM’:
$url = ‘https://s.id/xxxxx4’;
break;
case ‘PPI DASAR’:
$url = ‘https://s.id/xxxxx5’;
break;
case ‘PECCAMVID’:
$url = ‘https://s.id/xxxxx6’;
break;
case ‘VAKSINATOR’:
$url = ‘https://s.id/xxxxx7’;
break;
}return $url;
}, 10, 3);March 11, 2021 at 10:10 am #32655AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 11, 2021 at 4:55 pm #32662linuxParticipantYes, the second correct. My redirect working. Problem solve
- AuthorPosts
- You must be logged in to reply to this topic.