About how to insert a database to the create page of the CI tutorial

Source: Internet
Author: User
Tags codeigniter
Tutorial address (codeigniter.org.cnuser_guidetutorialcreate_news_items.html) Why do I click CreatenewsitemURL to change to test. comindex. phpnewstest. comindex. phpnewscreate? Then display 404 {generation...

Tutorial address (http://codeigniter.org.cn/user_guide/tutorial/create_news_items.html)
Why is the URL changed when I click Create news item?
Http://test.com/index.php/news/test.com/index.php/news/create? Then display 404

public function create(){    $this->load->helper('form');    $this->load->library('form_validation');    $data['title'] = 'Create a news item';    $this->form_validation->set_rules('title', 'Title', 'required');    $this->form_validation->set_rules('text', 'text', 'required');    if ($this->form_validation->run() === FALSE)    {        $this->load->view('templates/header', $data);        $this->load->view('news/create');        $this->load->view('templates/footer');    }    else    {        $this->news_model->set_news();        $this->load->view('news/success');    }}

I copied this code.

Normally, he needs to run the else part, but he does not know why he cannot run it.
The URL is also very strange.
If his if judgment statement is set up, it should also be the load view template, that is, the original page, right?
Why does it append a URL directly after the URL?

In config/config. php, set $ config ['base _ url'] to null.

Reply content:

Tutorial address (http://codeigniter.org.cn/user_guide/tutorial/create_news_items.html)
Why is the URL changed when I click Create news item?
Http://test.com/index.php/news/test.com/index.php/news/create? Then display 404

public function create(){    $this->load->helper('form');    $this->load->library('form_validation');    $data['title'] = 'Create a news item';    $this->form_validation->set_rules('title', 'Title', 'required');    $this->form_validation->set_rules('text', 'text', 'required');    if ($this->form_validation->run() === FALSE)    {        $this->load->view('templates/header', $data);        $this->load->view('news/create');        $this->load->view('templates/footer');    }    else    {        $this->news_model->set_news();        $this->load->view('news/success');    }}

I copied this code.

Normally, he needs to run the else part, but he does not know why he cannot run it.
The URL is also very strange.
If his if judgment statement is set up, it should also be the load view template, that is, the original page, right?
Why does it append a URL directly after the URL?

In config/config. php, set $ config ['base _ url'] to null.

Check whether there is anything like redirection in your code!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.