Welcome Guest, Not a member yet? Register   Sign In
Error 404 Object not found

Hello, I work almost one week on this problem and can´t think any furhter myself. 
I´m new at codeigniter and in php programming as well. 

I try to explain you my problem, but if you need more information please ask. 

My routes: 

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

In my controller' directory I have the file: login.php

PHP Code:
('BASEPATH') OR exit('No direct script access allowed');

Login extends CI_Controller {
function index () {

The index function here loads the view: first_message.php

      <title> Welcome to Rosa </title>
       <h2>Welcome to Rosa </h2>
       $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
       $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
       if (isset($username, $password)) {    
          if (!$username){
              //no username
           echo "Please enter a username.";
         if (!$password){
             //no Password
          echo "Please enter a password.";
      else {
          //Button isn´t set

       <form action='page1.php' method='post'>            
           Username: <input type="text" name="username"><br />
           Password: <input type="text" name="password"><br />            
           <input type='submit' value='Login'>

So far, everything works fine. The URL in my browser is now: localhost/home
After typing the username and the password I push the "Login"-Button. 

Now the browser links to this URL: http://localhost/home/page1.php to start page1.php:

PHP Code:
include_once 'application/views/second_message.php';
defined('BASEPATH') OR exit('No direct script access allowed');

Page1 extends CI_Controller {
function index () {

Instead, I get the error: 

Object not found! The requested URL was not found on this server.

So, I hope it became clear what my problem is and I hope you can give me hint to solve it. 

Thank you and best regards

Your page1 is it's own controller meaning the URL localhost/home/page1 will not work because page1 is not a method of the home controller.

Change the url to localhost/page1 or add the page1 method to your home controller.

It seems you don't understand the relation between URL and controller (file and name) in CodeIgniter.
See http://www.codeigniter.com/user_guide/general/urls.html
And it would be better you read http://www.codeigniter.com/user_guide/tu...index.html

Thank you for the hints.

Now I understand the constructs of an URL:

So, I know my page1.php should be a method of the controller-class login.php.

But I still don´t know how it helps me to open the view second_message.php if I click on the login-button.

So when I change to a method in the controller-class, what do I write in: .....action= ''.....   Huh

(This post was last modified: 11-14-2015, 12:04 PM by Martin7483.)

If page1 is a method of your Controller Login then your URL would be

And an action of a form points to a page...

Theme © iAndrew 2016 - Forum software by © MyBB