How to Redirect Form After Submission Based on Dropdown Value using Code in WPForms WordPress | URL

preview_player
Показать описание
In this wordpress tutorial for beginners you will learn how to add redirection in form after submit to any page or link (url) based on drop down value select / selection by user in dropdown menu list in plugin " Contact Form by WPForms – Drag & Drop Form Builder for WordPress " in wordpress website by adding custom code. So when user select specific value and after form submit then customer redirect to custom page or url.

** Find Custom Code in Top Pinned Comment Section.

** In custom code you can add your form ID and Field ID and drop down value and custom URL.

#redirection #dropdown #redirect #value #user #wpforms #form #code #wordpress #wordpresstutorial #webtaskwithhassan #hassangilani
Рекомендации по теме
Комментарии
Автор

Use this code:

function wpf_dev_process_redirect_url( $url, $form_id, $fields, $form_data, $entry_id ) {

// Only run on my form with ID = 2782.
if ( absint( $form_data[ 'id' ] ) !== 2782 ) {
return $fields;
}
// Assign the checkbox field that shows the dropdown to a variable
$form_value = $fields[4][ 'value' ];

if ($form_value === "Student") {

// Redirect to page with Student information
}
elseif ($form_value === "Professional") {

// Redirect to page with Professional information
}


else {

// Keep the current redirect URL that is set in the form builder settings
$url = $url;
}

return $url;
}
add_filter( 'wpforms_process_redirect_url', 'wpf_dev_process_redirect_url', 10, 5 );

WebTaskWithHassan
visit shbcf.ru