Need Help with Options page
-
I have the following code and when I try to set an option it does not work. does anyone have an idea why? I don’t get any errors, i just does not set the options.
if ( is_admin() ){ // admin actions add_action( 'admin_menu', 'add_mymenu' ); add_action( 'admin_init', 'register_mysettings' ); } else { // non-admin enqueues, actions, and filters } function register_mysettings() { $dropb_email = $_POST['dropb_email']; $dropb_pass = $_POST['dropb_pass']; $dropb_dest = $_POST['dropb_dest']; $dropb_remotedir = $_POST['dropb_remotedir']; register_setting('dropbox-options', "$dropb_email" ); register_setting('dropbox-options', "$dropb_pass" ); register_setting('dropbox-options', "$dropb_dest" ); register_setting('dropbox-options', "$dropb_remotedir" ); echo '<div id="message" class="updated fade"><p>Settings Updated!</p></div>'; } ?> <form method="post" action=""> <?php wp_nonce_field('update-options'); ?> <?PHP settings_fields('dropbox-options'); ?> <table class="form-table"> <tr valign="top"> <th scope="row">Email</th> <td><input type="text" name="dropb_email" value="<?php echo get_option('dropb_email'); ?>" /></td> </tr> <tr valign="top"> <th scope="row">Password</th> <td><input type="text" name="dropb_pass" value="<?php echo get_option('dropb_pass'); ?>" /></td> </tr> <tr valign="top"> <th scope="row">Destination</th> <td><input type="text" name="dropb_dest" value="<?php echo get_option('dropb_dest'); ?>" /> <strong>This must be a public folder</strong></td> </tr> <tr valign="top"> <th scope="row"></th> <td>Example: "public" would be the default public folder.</td> </tr> <th scope="row">Dropbox Account #</th> <td><input type="text" name="dropb_remotedir" value="<?php echo get_option('dropb_remotedir'); ?>" /> <strong>Your dropbox unique number</strong></td> </tr> <tr valign="top"> <th scope="row"></th> <td>Where do I find this?</td> </tr> <tr valign="top"> </table> <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="dropb_email,dropb_pass,dropb_dest,dropb_remotedir" /> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> </p> </form> </div>
- The topic ‘Need Help with Options page’ is closed to new replies.