我希望在提交表单时保存复选框的位置.
我的代码的问题是,如果用户启用或禁用复选框;在提交表单后,复选框被标记,并且不考虑用户的 Select .
我的代码是:
<?php
function tets_checkBox() {
if (isset($_POST['submit-post'])) {
if (isset($_POST['email-post'])) {
echo '<p class="alert alert-success">' . __('The checkbox is checked.') . '</p>';
} else {
echo '<p class="alert alert-danger">' . __('The checkbox is not checked.') . '</p>';
}
echo '<p class="alert alert-success">' . __('The settings for your account have been updated') . '</p>';
}
}
?>
<form method="post" action=" ">
<aside class="account_news">
<label class="account_mainBtn">
<input type="checkbox" name="email-post" checked>
</label>
<h3>Select.</h3>
</aside>
<input type="submit" name="submit-post" value="<?php _e('Update settings'); ?>">
</form>
Edit:个
我已将此表单放在用户帐户页面上,用户选中复选框以通过站点发送或不发送邮箱.
我希望当用户 Select 复选框模式时;保存该用户的复选框模式,以便在注销并重新输入帐户后,仍保持该用户的复选框模式.