WordPress Plugin Development – get_option error

I am trying to put the option on selected with the built in function of wordpress called selected. I have tried to change the key from opt to different key names for every select field and it still didn’t work.

At the moment i am stuck, see my code below:

$taxonomy_args = array(
    'public'    =>  true,
    '_builtin'  =>  false

$taxonomy_names = get_taxonomies($taxonomy_args);

$select_field = get_option('select_field');

echo "<form id='example_details' method='post' action''>";
    foreach( $taxonomy_names as $taxonomy_name ) {
        echo "<div class='div_fields'>";
        $taxonomy_name_lc = strtolower($taxonomy_name);
        echo "<label for='${taxonomy_name_lc}_select_field'>${taxonomy_name}</label>";
            echo "<select class='example_form_select' name='details_select_field[opt]' id='${taxonomy_name_lc}_select_field'>";
                echo "<option></option>";
                $terms = get_terms( array( 
                    'hide_empty'    => false,
                    'taxonomy'      => $taxonomy_name
                ) );
                foreach ($terms as $term) {
                    echo "<option id='" . $term->name . "' value='" . $term->name . "' " . selected(isset($select_field['opt']), $term->name) . ">" . $term->name . "</option>";

            echo "</select>";
        echo "</div>";
    wp_nonce_field( $this->plugin, 'details_nonce' );
echo "</form>"; 

I did a var_dump on the $select_field variable but that one returns a boolean of false.

Go to Source
Author: Otto