[eluser]elmne[/eluser]
I have encountered a problem.
when i implement the following controller
Code:
<?php
class Customertype extends Controller {
function index()
{
echo 'Hello World!';
}
function customertype_add()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('customer_type', 'Customer Type', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('admin/customertype_add');
}
else
{
$this->load->model('Customertype_class','',TRUE); // TRUE autoconnects model to database
$this->Customertype_class->add_customertype();
$this->load->view('admin/customertype_added');
}
}
}
?>
and i have this form to submit to the controller
Code:
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<p> </p>
<p>Customer Type:
<input type="text" name="customer_type" />
</p>
<p>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
</body>
</html>
I get the following error when i run the form
Quote:localhost/xxxx/index.php/form.html
404 Page Not Found
The page you requested was not found.
The controller is in admin folder controllers/admin/customertype.php
The view is in the view folder views/admin/customertype_add.php
I then access the controller at
Quote:localhost/xxxx/index.php?admin/customertype/customertype_add
But when i click "submit", it brings up the url
Quote: localhost/xxxx/index.php/form.html
and then the error message "Not Found"
What's the cause of this?