• my settings API <select> element is storing the selection in the database however when i submit the form it reloads the options and does not display the selected option – for example my options go from 1 to 12.
    when i select option 12 and click submit the page reloads and option 1 is displayed in the drop down list. option 12 is saved in my database and i can use it in my theme but for users who want to change which value they have and cant remember which ones they picked last this is incredibly inconvenient!

    here is the function im using to display and store the options in my database:

    function  setting_dropdown_fn() {
    	$options = get_option('rtms_options');
    	echo "<select name='rtms_options[page_string]'>" ;
       $pages = get_pages();
      foreach ( $pages as $pagg ) {
      	$option = '<option value="' . get_page_link( $pagg->ID ) . '">';
    	$option .= $pagg->post_title;
    	$option .= '</option>';
    	echo $option;
      }
    echo '</select>';}

Viewing 1 replies (of 1 total)
  • Thread Starter accounts@push

    (@accountspush)

    for those who find this hard to read im essentially trying to get the <select> element to display the currently selected option when the page loads

Viewing 1 replies (of 1 total)
  • The topic ‘not displaying selected item’ is closed to new replies.