【发布时间】:2012-05-06 08:31:33
【问题描述】:
我有一个名为 Register 的控制器,如下所示:
class Register extends CI_Controller
{
public function index()
{
$this->load->view('register');
}
public function create()
{
$this->load->library('form_validation');
//set rules here
if ($this->form_validation->run() == TRUE)
{
//everything checks out
}
else
{
$this->load->view('register');
}
}
}
视图包含一个发送到register/create 的表单。
我的问题是,当我去localhost/register并错误填写表格时,表格会重新加载,但现在的网址是:
localhost/register/register/create
如果我再次输入错误
localhost/register/register/register/create
等等……
我猜这是htaccess,我尝试使用一些在线提供的标准 CodeIgniter htaccess 文件,但没有一个能解决这个问题。我在 WAMP 服务器上使用它。
编辑
目前,视图文件仅包含表单。我更喜欢使用直接 HTML 而不是 CodeIgniter 表单助手。
<form id="register_form" method="post" action="register/create" title="Create an Account">
<!-- input fields -->
</form>
【问题讨论】:
-
请发布您的视图文件 - 特别是表单打开部分 - 听起来您的操作 URL 错误
-
@Ula, Laurencei :我已经在上面发布了视图文件。
标签: php apache .htaccess codeigniter wamp