如果我包含http://,Codeigniter form_validation不会运行

时间:2014-08-12 23:10:00

标签: codeigniter validation

我在使用表单时遇到问题。我已经多次测试了,似乎问题出在一个带有http://的字符串上。每当我输入www.mywebsite.com时它就会运行但是只要我输入http://mywebsite.com,表单就不会运行。任何人都可以帮忙??

controller(add.php)

public function add_validation(){

    $this->load->library('form_validation');    
    $this->form_validation->set_rules('add', 'Add', 'required|trim');

    if ($this->form_validation->run()){
        echo "The form validation ran";
        //redirect('main/members');
    }else{
        echo "The form validation didn't ran";
        //redirect('main/members');
    }
}

view(header.php)

            echo form_open('add/add_validation');

            //echo validation_errors();

            $text = array(
                'name' => 'add',
                'id' => 'text',
                'placeholder' => 'http://'
                );

            echo form_input($text);

            $submit = array(
                'name' => 'add_submit',
                'id' => 'submit',
                'value' => '+',
                );

            echo form_submit($submit);

            echo form_close();

0 个答案:

没有答案