我正在努力在我的主题选项页面中保存正确的数据。这是我函数中的代码。php文件:
<?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 } ?>
当我提交数据时,它会保存数据,但在菜单中单击几下或在网站中刷新后,数据就会消失。我看不出问题在哪里,但我相信这对这里的人来说是显而易见的。有什么帮助吗?请