I am struggling to save the correct data in my themes options page. Here is my code in my functions.php file:
<?php
if ( get_option( 'everes_options' ) ) {
$everes_options = get_option( 'everes_options' ); }
else {
add_option( 'everes_options', array(
'everes_pdf' => '1',
'everes_showBlog' => '1'
) );
$everes_options = get_option( 'everes_options' ); }
}
function everes_options(){
global $everes_options;
?>
<div class="wrap">
<h2>Resume Options</h2>
<form action="edit.php?post_type=employment&page=resume_options" method="post">
<table>
<tr>
<td>Print as PDF?</td>
<td>
<select name="everes_pdf">
<option value="1" <?php selected( '1', $everes_options['everes_pdf'] ); ?> >Yes</option>
<option value="0" <?php selected( '0', $everes_options['everes_pdf'] ); ?> >No</option>
</select>
</td>
</tr>
<tr>
<td>Show blog</td>
<td>
<select name="everes_showBlog">
<option value="1" <?php selected( '1', $everes_options['everes_showBlog'] ); ?> >Yes</option>
<option value="0" <?php selected( '0', $everes_options['everes_showBlog'] ); ?> >No</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><?php submit_button(); ?></td>
</tr>
</table>
</form>
</div>
<?php } ?>
When I submit the data, it will save the data, but after a few clicks in the menu, or refreshed in the website, the data disappears. I can't see where the issue is, but I do believe that it would be glaringly obvious to someone here. Any help? Please?
edit.php
? Anyway, you should use the Settings API to build a theme or plugin options page.