Jonas David
Jonas David

Reputation: 45

Unable to connect with Codeigniter

here is my View login.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome</title>

    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
        <link rel="stylesheet" href="assets/css/signing.css">

    <link rel="stylesheet" href="assets/js/bootstrap.min.js">
</head>
<body>
<div class="container">

       <?php echo form_open('Login/validate_credentials',['class'=>'form-signin']); ?>
        <h2 class="form-signin-heading">Please sign in</h2>
        <label for="inputEmail" class="sr-only">Email address</label>
        <input type="email" id="inputEmail" name ="username" class="form-control" placeholder="Email address" required autofocus>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required>
        <div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> Remember me
          </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
      </form>

    </div> ``

here how it look

locahost/ci/

enter image description here

when i click it show the following page ,. No Error in apache log and access log or mysql log Error page enter image description here

the Controller page is here **

<?php 
class Login extends CI_Controller{
    public function index(){
        $this->load->view('login');
    }
    public function validate_credentials()
    {
        $data =array(
            $username=$this->input->post('username'),
            $password=$this->input->post('password')
            );
        $this->load->model('Login');
        $result=$this->login->validate($data);
        if($result==true)
        {
            redirect('welcome');
        }
        else{
            echo "not found";
        }
    }
}
?>

Configuration

$config['base_url'] = 'http://localhost:8080/ci';
$config['index_page'] = 'index.php';

routes.conf */

$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

**

Upvotes: 0

Views: 322

Answers (2)

Anshul
Anshul

Reputation: 116

Your CI not setup correctly. As according to your screenshots :

First Screenshot URL : http://localhost/ci

Second Screenshot URL : http://localhost:8080/ci

Change your configuration :

$config['base_url'] = 'http://localhost/ci';
$config['index_page'] = 'index.php';

Upvotes: 0

kashif
kashif

Reputation: 193

Change Configuration to

$config['base_url'] = 'http://localhost/ci';
$config['index_page'] = 'index.php';

Upvotes: 1

Related Questions