| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Saving Options From a Dropdown Selection on an Admin Options Page|
I'm trying to get a submit button to save my data on a wordpress admin opti
I'm trying to create my first plugin and have gotten as far as creating the options admin page, adding it to the menu, showing a drop down box and showing a submit button.
Howsomever, I cannot get the form to save the value, or update an existing option.
As a non-coder, I have gotten myself lost trying to understand the codex and the api, including being unable to copy and paste the options page examples that are shown and make them work.
If you can help me, please, please jump right in and tell me what to do. Here's what I have for a form so far ...
// Plugin title and some other stuff
<!-- Opening The Form -->
<form method="post" action="options.php">
settings_fields( 'products' );
<!-- Inserting The Dropdown Box On The Page And Inside The Page Function -->
<!-- Using selected() instead -->
<option value="unicykes" <?php selected( $options['products'], unicykes ); ?>>unicykes</option>
<option value="bikes" <?php selected( $options['products'], bikes ); ?>>bikes</option>
<option value="trikes" <?php selected( $options['products'], trikes ); ?>>trikes</option>
do_settings_fields( 'products' );
<input type="submit" value="<?php _e( 'Save Options', 'products' ); ?>" />
// End of page
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved