With codeigniter, I have a controller as in the following:
if You Want to call controller function like this /CodeIgniter/myController/myFn
then,
You have to remove index.php file using .htaccess file. First You change config.php file like this.
// Remove index.php
$config['index_page'] = ""
then, create .htaccess file and copy this code to that file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Then, put this .htaccess file inside codeignator project folder.
To Reference see this link:- enter link description here
In your controller just delete ' ** '.
<?php if(!defined ('BASEPATH')) exit('not found basepath');
class myController extends CI_Controller{
function __constructor(){
parent::__constructor();
}
public function index(){
$this->load->view('myview');
}
public function myFn(){
echo "my controller is called";
}
}
?>
And In your view try:
<?php echo form_open('myController/myFn'); ?>
<?php echo form_submit('submit','SUBMIT'); ?>
when you run the view
<form action="<?php echo base_url();?>myController/myFn" method="post" name="myform">
<input type="submit" name="submit" value="submit"/>
</form>
use inspect element to see if the action in the form tag is same as
**http://localhost/CodeIgniter/index.php/myController/myFn**
I think you forgot to load URL helper
function test()
{
$this->load->helper('url');
$data['message']= $this->input->post('message');
$this->load->view('backend/test',$data);
}
this might help you