try this:
//first get all agents
$agents = new WP_Query(array(\'post_type\' => \'agent\', \'posts_per_page\' => -1, \'order\' => \'ASC\', \'orderby\' => \'title\'));
//then just print out the dropdown:
if ($agents->have_posts()){
echo \'<select id="agent">\';
while ($agents->have_posts()){
$agents-the_post();
echo \'<option value="\'.get_permalink($post->ID).\'">\'.get_the_title($post->ID).\'</option>\';
}
?>
</select>
<script type="text/javascript">
<!--
var dropdown = document.getElementById("agent");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
location.href = dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
-->
</script>
<?php
}