• Hwo can i make a good searchform with
    t_region is a value in a post

    searchform imput:

    <?php global $t_sregion;
    $t_sregion =  isset($custom["t_sregion"][0]) ? $custom["t_sregion"][0] : ''; ?>
    
    <form method="get" id="searchform1" action="<?php echo home_url(); ?>">
    					<input type="text" value="<?php esc_attr_e('','theme'); ?>" name="s" id="searchinput" /> <select id="t_sregion" name="t_sregion">
    			<option value="">All regions</option>
    			<?php foreach ($sregion as $key => $value) { ?>
    				<option <?php if (htmlspecialchars($t_sregion) == $key) echo('selected="selected"')?> value="<?php echo esc_attr($key); ?>"><?php echo esc_html($value); ?></option>
    			<?php }; ?>
    		</select>
            <?php wp_dropdown_categories( $args ); ?>
            <input type="image" src="<?php bloginfo('template_directory'); ?>/images/search-icon.png" id="searchsubmit" />
    				</form>

    search results:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div class="post clearfix">
    				<?php $custom = get_post_custom($post->ID);
    				if ( isset($_POST['t_region']) == $t_sregion )
    				{

    //searchform
    //end

    How can i do it?

  • The topic ‘Searchform & results’ is closed to new replies.