Php 代码点火器表格403
我无法使用Codeigniter 3.1.6提交表单,因为我正在 POST数据不会转到Php 代码点火器表格403,php,codeigniter,http-status-code-403,Php,Codeigniter,Http Status Code 403,我无法使用Codeigniter 3.1.6提交表单,因为我正在 POST数据不会转到修订/更新。除了这一页,我的另一页的表格工作得很好。我没有使用AJAX 查看 <?=form_open('revise/updates');?> <input type="text" name="name" value="<?=$lead[0]['name'];?>"> <input type="hidden" name="id" value="<?=
修订/更新
。除了这一页,我的另一页的表格工作得很好。我没有使用AJAX
查看
<?=form_open('revise/updates');?>
<input type="text" name="name" value="<?=$lead[0]['name'];?>">
<input type="hidden" name="id" value="<?=$lead[0]['id'];?>">
<input type="email" name="email" value="<?=$lead[0]['email'];?>">
<input type="text" name="contact" value="<?=$lead[0]['phone_number'];?>">
<input type="text" name="company" value="<?=$lead[0]['comp_name'];?>">
<input type="text" name="va" value="<?=$lead[0]['va'];?>" readonly>
<input type="text" name="sales" value="<?=$lead[0]['sales_name'];?>" readonly>
<input type="text" name="service" value="<?=$lead[0]['service_name'];?>" readonly>
<textarea name="note"><?=$lead[0]['note'];?></textarea>
<input type="hidden" name="opt" value="yes">
<input type="hidden" name="cmd" value="1">
<button type="submit" name="submit">Confirm</button>
<?=form_close();?>
证实
控制器
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Revise extends VA_Controller {
function __construct () {
parent::__construct();
$this->load->helper('form');
$this->load->library('form_validation');
}
public function index($array)
{
$this->load->view('header');
$this->load->view('update-lead',$array);
$this->load->view('footer');
}
public function updates() {
$this->form_validation->set_rules('name', 'Name', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('contact', 'Contact', 'trim|required');
$this->form_validation->set_rules('company', 'Company Name', 'trim|required');
$this->form_validation->set_rules('service', 'Service', 'trim|required');
$this->form_validation->set_rules('va', 'vAmbassador', 'trim|required');
$this->form_validation->set_rules('sales', 'Sales Person', 'trim|required');
$this->form_validation->set_rules('note', 'note', 'trim');
if($this->form_validation->run() == true) {
echo "OK";
}
else {
echo "Some Error";
}
}
}
您必须从/application/config/config.php
验证设置是否正确403禁止错误可能是由于错误的。htaccess
重写。请尝试修改现有控制器,如下面的代码所示
class Revise extends CI_Controller {
function __construct () {
parent::__construct();
$this->load->helper('form');
$this->load->library('form_validation');
if(!isset($_SESSION["logged_in"]) && !isset($_SESSION["username"]) && $_SESSION["logged_in"] !== TRUE && $_SESSION["username"] !== 'example@example.com' )
{
redirect('/login');
}
}
重新启动发动机
1美元^(index.php | resources | assets | robots.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-我已经在RewriteCond%{REQUEST_FILENAME}上有了.htaccessRewriteEngine-f RewriteCond%{REQUEST_FILENAME}-重写的规则^(.*)$index.php/$1[L]
和index.php在配置中也被省略。php@Rey备份当前文件并替换此文件。我尝试过,但它会重定向到主页。这是表单example.com/folder/admin/update
@Rey的链接,您可能应该尝试另一个名称,因为codeigniter本身可能使用了update
关键字。我更改了类名,但仍然出现错误。这只是我的猜测,我想你不能用Update
创建新的类或控制器,因为它在codeigniter中已经预定义了类或控制器。@Ayyappaamara我更改了类名,但仍然得到错误。你能发布完整的控制器吗page@Ayyappaamara我更新了问题什么是VA_控制器
?是定制控制器吗?您是否已在config/autoload.php
中加载了此文件?
class Revise extends CI_Controller {
function __construct () {
parent::__construct();
$this->load->helper('form');
$this->load->library('form_validation');
if(!isset($_SESSION["logged_in"]) && !isset($_SESSION["username"]) && $_SESSION["logged_in"] !== TRUE && $_SESSION["username"] !== 'example@example.com' )
{
redirect('/login');
}
}