$term_id .= $_POST['main_brand_id'];
$term = get_term( $term_id, 'state' );
$slug = $term->slug;
global $post;
$args = array( 'post_type' =>'dealers','taxonomy'=>'state', 'term' => $slug );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
echo '<option>';
$options .= '<option value="'.$post->id.'">';
$options .= the_title();
echo '</option>';
endforeach;
I have to pass the post id to get the output as below
<option value="24">Andhra Pradesh</option>
<option value="29">Bangalore</option>
<option value="44">Delhi</option>
This piece of code is not working........
$options .= '<option value="'.$post->id.'">';
This is the output im getting
<option>Andhra Pradesh</option>
<option>Bangalore</option>
<option>Delhi</option>
can anyone help me....