Require selected dropdown list title-name as variable
-
I’m new to WordPress but fairly ok with php. I want to select an item from a dropdown list of Titles and send it to another page for processing with if(isset($Post[‘title’]) etc.
However when I select an item title from the dropdown and hit send, it takes me to the actual page of that title itself with links forward and back to all the other pages in the Title list.
I’ve tried a few things like attempting to make a string of the selected Title, and getting the list using get_post_meta(), but the end result is always the same as above.
If anyone can just point me in the right direction that would be fantastic.[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
<form action="<?php bloginfo('url'); ?>/booking-times" method="post"> <div class="style"> <select class="style" id="style" name="style"> <option value="" selected="selected">Select preferred style</option> <?php $args = array( 'post_type' => 'style', 'meta_key' => 'style_type', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish' ); $style_listing= new WP_Query( $args ); ?> <?php if ( $style_listing->have_posts() ) : ?> <?php while ( $style_listing->have_posts() ) : $style_listing->the_post(); ?> <option id="<?php the_id(); ?>" class="style" value=" <?php the_title(); ?>"><?php the_title(); ?></option> <?php endwhile; ?> <?php endif; ?> </select> </div><!--end div class style--> </div><!--end div id style--> <div id="submit"> <input class="data-submit" type="submit" name="submit" value="Next"> </div><!--end submit--> </form>
- The topic ‘Require selected dropdown list title-name as variable’ is closed to new replies.