So I got exactly this 404 error :
Not Found
The requested URL /adminigniter1/Usercontroller/insert was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
When I wanted to call a function from the controller, from what I read about it has to do with the the .htaccess file(and I placed that in my source folder adminigniter1), but mine seems to look ok:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /adminigniter1/index.php
</IfModule>
From my index.php I send to that controller function like this:
<form method = "POST" action = "<?php echo base_url('Usercontroller/insert') ?>">
And this is my controller :
<?php
class Usercontroller extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Usermodel');
}
public function index() {
$data["content"]= "user/index";
$data["getStatus"] = $this->Usermodel->getStatus();
$this->load->view("main",$data);
}
public function insert() {
$datai= $this->input->post();
if(isset($datai)){
echo $datai['txtApartament'];
exit;
}
}
}
What can be wrong ?