Hi, i have created 2 controller: Main and Form and i have set this routes:
PHP Code:
/**
* --------------------------------------------------------------------
* Router Setup
* --------------------------------------------------------------------
*/
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Main');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(true);
$routes->set404Override();
$routes->setAutoRoute(true);
/**
* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------
*/
// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Main::index');
$routes->add('(:any)', 'Main::$1');
When i submit the form i receive 404.
If i add a method named form in Main controller all is ok.
How can i solve this problem. I would like have 2 different controller.
Code:
<form id="myForm" action="<?php echo base_url('form');?>" method="post" novalidate>
<input type="text" name="foo">
....
....
</form>
Thanks for help me.