|
用ci 3.x 在练习写一个blog遇到一些问题http://localhost/blog/post/6 这是其中一篇文章
文章下方有个回应文章的功能,提交的路由为
http://localhost/blog/comments/add_comment/6
问题:
如果form_validation= FALSE , redirect 后, 為什麼无法显示 form_error 信息,
请问是哪里出问题了呢?
class Comments extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function add_comment($post_id){
$name = $this->input->post('name',true);
$email = $this->input->post('email',true);
$comment = $this->input->post('comment',true);
$this->form_validation->set_rules("name", "name", "trim|required");
$this->form_validation->set_rules("email", "email", "trim|required");
$this->form_validation->set_rules("comment", "comment", "trim|required");
if ($this->form_validation->run() == FALSE)
{
redirect('post/$post_id);
}
else
{
}
}
|
|