![]() |
how to submit a form from view to specific method of specific controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how to submit a form from view to specific method of specific controller (/showthread.php?tid=38900) |
how to submit a form from view to specific method of specific controller - El Forum - 02-22-2011 [eluser]manishchndk[/eluser] Dear friends, i am not able to submit a form to a particular controller in codeigniter 2.0 but the same is working good with codeigniter 1.7 version. I have written the code below, if any one of you know this help me. Note: Car is the project Name My default controller is set to welcome.php In config.php i defined a variable as $config['base_url'] = 'http://localhost/car/'; The code which i have written in view : welcome_view.php <body> <form name="admin_login" id="id_login" action="<?php echo base_url(); ?>user/login" method="POST" > User Name <input type="text" name="login_name" id="login_name" /> Password <input type="password" name="login_password" id="login_password" /> <input type="submit" name="register" id="register" value="Register" /> </form> </body> I want to submit the form details to a controller name "user.php" having method login but it is showing me an error message that: "The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error." but the same code is working fine in codeigniter 1.7 version i don't know what to do. can anyone help me in that. how to submit a form from view to specific method of specific controller - El Forum - 02-22-2011 [eluser]InsiteFX[/eluser] Try changing the URL Protocol! Code: /* InsiteFX how to submit a form from view to specific method of specific controller - El Forum - 02-23-2011 [eluser]manishchndk[/eluser] i tried the way u told me but still getting the same error message any other solution do u know even i am not able redirect to other methods of default controller, it is executing only index function of default controller. how to submit a form from view to specific method of specific controller - El Forum - 02-23-2011 [eluser]Cristian Gilè[/eluser] Probably index.php is missing in the form action. The right version: Code: <form name="admin_login" id="id_login" action="<?php echo base_url(); ?>index.php/user/login" method="POST" > You can also use the site_url(). index.php will be added to the URL automatically. Code: <form name="admin_login" id="id_login" action="<?php echo site_url('user/login'); ?>" method="POST" > Cristian Gilè |