• Hi there

    I’m listing taxonomies in a dropdown on a taxonomy template using this code :

    <?php
    function get_terms_dropdown($taxonomies, $args){
    	$myterms = get_terms($taxonomies, $args);
    	$output ="<select name='area'>";
    	foreach($myterms as $term){
    		$root_url = get_bloginfo('url');
    		$term_taxonomy=$term->taxonomy;
    		$term_slug=$term->slug;
    		$term_name =$term->name;
    		$link = $term_slug;
    		$output .="<option value='".$link."'>".$term_name."</option>";
    	}
    	$output .="</select>";
    return $output;
    }
    ?>
    <form action="<?php bloginfo('url'); ?>" method="get">
    <?php
    $taxonomies = array('area');
    $args = array('orderby'=>'name','hide_empty'=>false);
    $select = get_terms_dropdown($taxonomies, $args);
    echo $select;
    ?>
    <input type="submit" value="View" />
    </form>

    Works fine but when I add a variable to the link:
    $link = $term_slug.'/?id=map';
    it adds it fine to the html output but on submit alters the url from :

    mysite.com/area/north-central/

    to

    mysite.com/?area=south-central%2F%3Fid%3Dmap

    Which throws up a 404.

    Any pointers please?

The topic ‘url string changes’ is closed to new replies.