I’m learning CI to create some simple web apps and trying to send form data to a controller for processing. I am not able to get it working if I use base_url if I use site_url or the form_open() it works.. I don’t want to see the ../index.php/controllerName though in the Browser URL… And frankly am annoyed I can’t get it working with base_url() so now I’m being stubborn..
The error I’m getting is:
Not Found The requested URL /submit was not found on this server.
I simplified everything to try and troubleshoot.. Hopefully below is enough for somebody to shed some light..
View “home.php”:
<form method="post" action="<?php echo base_url('submit');?>"> <!— Does NOT work —>
<!— <form method="post" action="<?php echo site_url();?>/submit"> ——Works-—>
<!— <?php echo form_open('submit'); ?> ——Works-—>
<input type="submit" name="formname" id="formid" value="submit">
</form>
Controller “submit.php” :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Submit extends CI_Controller {
public function __construct() {
parent::__construct();
echo "Inside Submit Controller";
}
public function index(){
}
}
config files: config/config.php $config[‘base_url’] = ‘http://dev.mbp.ci/’; $config[‘index_page’] = ‘index.php’;
config/autoload.php $autoload[‘helper’] = array(‘html’, ‘url’, ‘form’);
Structure: - Applications->Controllers->submit.php - Applications->Views->home.php
Web server is MAMP Pro with PHP 5.6.2
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.