demo

<select name="my_great_select">
    <?php foreach ($posts as $post): ?>
        <option value="<?php echo $post->ID; ?>"><?php echo $post->post_title; ?></option>
    <?php endforeach; ?>
</select>