I am trying to do some import / export option for a script (wordpress plugin) using the settings API .
the relevant part of the code is :
function o99_brsa_options_page() {
global $o99_brsa_options; // declare as global so we can access everywhere
$o99_brsa_options2 = get_option( 'o99_brsa_settings' );
$currentsettings = "";
if ( isset( $_POST['import'] ) && trim($_POST['brsa_keep_settings_imp']) != "" ) {
$currentsettings = base64_encode($_POST['brsa_keep_settings_imp']);
} elseif ( isset( $o99_brsa_options2 ) && ( $o99_brsa_options2 != "" ) ) {
$currentsettings = base64_encode( serialize( $o99_brsa_options2 ) );
}
// continue a lot of settings ...
<!-- / IMPORT o99_brsa_settings[brsa_keep_settings_exp] -->
<p>
<form method="post" action="#">
<textarea cols="50" rows="5" id="brsa_keep_settings_imp" name="brsa_keep_settings_imp" /><?php
?></textarea>
<label class="description" for="brsa_keep_settings_imp">
</br><?php _e('Import Data', 'k99-brsa-domain'); ?>
</label>
<input type="submit" value="Import" id="import" name="import" class="button-primary" onClick="return confirm('Are you sure you want to import these settings?')" />
</form></p>
}
the full code is here :
http://pastebin.com/uBHHxJYJ
I can just not find what am I doing wrong, and why is it not working, I am obviously missing something here …