-固定-
当我提交表单时,我想在表中编辑的行强制为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页面发送值,下面是"process.php?task=edit_notify":
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');
}发布于 2017-09-15 01:55:22
我找到解决办法了!在我的define('BASE_URL', 'https://monkstudio.biz/');里
因为我在.htaccess上有我的网站链接"www",在这里没有设置它的脚本,现在我把define('BASE_URL', 'https://www.monkstudio.biz/');和它工作得很好!
我很自豪我自己找到了这个。
https://stackoverflow.com/questions/46229806
复制相似问题