Welcome Guest, Not a member yet? Register   Sign In
The requested URL /ci_login/user/login was not found on this server. Help
#1

[eluser]doforumda[/eluser]
Hi I am new to codeigniter. I am making a login system. I just finished login form but when i hit login button then it displays this error

Code:
The requested URL /ci_login/user/login was not found on this server.

here is my code so far
user.php file which is in controller forlder
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User extends CI_Controller {
    function __construct() {
        parent::__construct();
    }
    
    function index() {

    }
    
    function login() {
        
        if($this->form_validation->run() == FALSE) {
            $this->load->view('view_login');
        } else {
            echo "Successfull";
        }
    }
}

view_login.php file which is in view folder
Code:
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Please Login!</h1>

<p>Use the login form below to login.</p>
<div id="login_form">
    &lt;?php echo form_open(base_url(). 'user/login' ) ?&gt;
    <label>Username:</label>
    <div>
        &lt;?php echo form_input(array('id' => 'username', 'name' => 'username')); ?&gt;
    </div>
    <label>Password:</label>
    <div>
        &lt;?php echo form_password(array('id' => 'password', 'name' => 'password')); ?&gt;
    </div>
    <div>
        &lt;?php echo form_submit(array('name' => 'submit'),'Login'); ?&gt;
    </div>
    &lt;?php echo form_close(); ?&gt;
</div>
&lt;/body&gt;
&lt;/html&gt;

help please how can I solve this error?
#2

[eluser]InsiteFX[/eluser]
Did you load the url_helper ?

application/config/autoload.php
Code:
$autoload['helper'] = array('url');

InsiteFX
#3

[eluser]doforumda[/eluser]
yeah here it is

Code:
/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array('form','url');
#4

[eluser]InsiteFX[/eluser]
Try changing this:
Code:
// form this
&lt;?php echo form_open(base_url(). 'user/login' ) ?&gt;

// to this:
&lt;?php echo form_open('user/login') ?&gt;

InsiteFX
#5

[eluser]doforumda[/eluser]
Thanks it is working now. Can you tell me why was it not working before with base_url()?
#6

[eluser]InsiteFX[/eluser]
Show me what you have your base_url set to. But normally that is how you set the form_open

InsiteFX
#7

[eluser]doforumda[/eluser]
Can you tell me where can we set base_url. As I said I am new to codeigniter so I do not know where to set base_url.
#8

[eluser]osci[/eluser]
User Guide - Installation




Theme © iAndrew 2016 - Forum software by © MyBB