I need to apend a certain word to the URL based on which option from a dropdown is selected, to create a custom confirmation screen URL. It doesn\'t matter which contact form I
A dropdown is a <select>
element not an <input>
.
Of course this can be done I would recommend making a small plugin for this and adding the redirect to the init
action something like this.
<?php
/*
Plugin name: redirect on post
Desciption: http://stackoverflow.com/questions/13686245/how-to-create-a-custom-url-based-on-dropdown-in-wordpress-form-submission
*/
function redirect_on_submit() {
// check if the post is set
if (isset($_POST['dropdown_name']) && ! empty ($_POST['dropdown_name'])) {
header( "Location: http://mysite.com/result/?" . $_POST['dropdown_name'] );
}
}
add_action('init', redirect_on_submit);
add this to a new file in the plugin folder and activate it in the plugin menu.