Metabox is not showing current chosen item from Database

Metabox Select item does update the Database but does not reflect that choice in metabox. This metabox is special in the sense that it is using a list contained in an options page for my plugin. I am using a get_option() command along with a foreach statment. Code below is the metabox.

function timeshare_meta_callback( $post ) {
wp_nonce_field( basename( __FILE__ ), 'timeshare_nonce' );
$timeshare_stored_meta = get_post_meta( $post->ID );
 ?>
<table style="width:100%">
 <tr>
    <td>
  <p>
    <?php
        $options = get_option( 'name' );
        // If your names are separeated with comma
        $names = explode( PHP_EOL, $options );
        ?>
        <label for="name" class="timeshare-row-title"><?php _e( 'Property Name:', 'timeshare-textdomain' )?></label>
        <select name="name" id="name">
        <?php foreach ( $names as $name ) {
        printf(
                 '<option value="%s" selected="selected">%s</option>',
                $name,
                $name 

            );
        } ?>

        </select>
      </p>
 < /td>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.