Hello, this is php in codeigniter. I have posted the same topic in codeigniter discussion forum, but I get a really long time to get a reply and some times do not get a reply at all. So may be if there are some codeigniter experts in this forum might be great. :).
controllers/pages.php
<?php
class Pages extends CI_Controller {
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');
}
}
}
views/news/create.php
<h2>Create a news item</h2>
<?php echo validation_errors(); ?>
<?php echo form_open('news/create') ?>
<label for="title">Title</label>
<input type="input" name="title" /><br />
<label for="text">Text</label>
<textarea name="text"></textarea><br />
<input type="submit" name="submit" value="Create news item" />
</form>
I point the url to: http://localhost/News/index.php/pages/create
This error appears:
404 Page Not Found
The page you requested was not found.
Why is it?