- 已修复 -
当我提交表单时,我想在表格中编辑的行强制为0而不是设置0或1(当我切换时)。这意味着表(行)以某种方式获得值0。
这是我的表格:
<form class="form-horizontal" action="<?php echo BASE_URL?>process.php?task=edit_notify" method="post">
<div class="form-group">
<div class="material-switch pull-left">
<p><span class="control-label" style="color: rgba(75, 75, 75, 0.6); cursor: default;"><?php echo ADMIN_NOTIFY; ?></span></p>
<input id="allow_reg_msg" name="allow_reg_msg" type="checkbox" value="1" <?php if($row['allow_reg_msg'] == 1) echo "checked='checked'"; ?> />
<label for="allow_reg_msg" class="label-primary"></label>
</div>
</div></br>
<div class="form-group">
<button type="submit" class="btn_"><i class="fa fa-pencil"></i> <?php echo EDIT; ?></button>
</div>
</form>
当我提交时,它应该向process.php页面发送值,这里是&#34; process.php?task = edit_notify&#34;:
if(isset($_GET['task']) && $_GET['task'] == "edit_notify"){
if(!$user->isLoggedIn()) Redirect::to('index');
if(!$user->hasPermission('admin')) Redirect::to('index');
$allow_reg_msg = $_POST['allow_reg_msg'];
$sql = "UPDATE `settings` SET
`allow_reg_msg` = :allow_reg_msg
WHERE `id` = 1";
$query = $handler->prepare($sql);
$query->execute(array(
":allow_reg_msg" => $allow_reg_msg
));
Session::flash('edit_site_success', SUCCESS_UPDATE);
Redirect::to('admin/index.php?page=edit_site');
}
答案 0 :(得分:0)
我找到了解决方案!它在我的define('BASE_URL', 'https://monkstudio.biz/');
因为我在.htaccess我的网站链接“www”,这里的脚本没有设置,现在我把define('BASE_URL', 'https://www.monkstudio.biz/');
并且它工作正常!
我很自豪我自己找到了这个。