Welcome Guest, Not a member yet? Register   Sign In
Unable to load the requested file: login_form.php
#1

[eluser]Bhavani Shekhawat[/eluser]
I cant seem to find the reason behind this error. I am inserting my piece of code here; Would be very helpful if you can guys can help me out with this.

login.php
Code:
class Login extends Controller{
    
    
  function index()
  {
     $data['main_content'] = 'login_form';
     $this->load->view('includes/template', $data);
  }
}

template.php
Code:
<?php     $this->load->view('includes/header');  ?>

<?php     $this->load->view($main_content);  ?>

<?php     $this->load->view('includes/footer');  ?>


login_form.php
Code:
<div id="login_form">
<h1>Login Form</h1>

&lt;?php
  
  echo form_open('login/validate_credentials');
  echo form_input('username', 'Username');
  echo form_password('password', 'Password');
  echo form_submit('submit', 'Login');
  echo anchor('login/signup', 'Create Account');

  ?&gt;
</div>


routes.php
Code:
$route['default_controller'] = "login";


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

Header and footer already have their respective content inside that and there is not any stupid mistake from my side since I have reviewed the code multiple times.
#2

[eluser]erik.brannstrom[/eluser]
Unable to load the requested file is only shown when - obviously - the file cannot be found. For example, do you have login_form.php directly in your views folder? Otherwise, could you give us your folder structure?
#3

[eluser]Bhavani Shekhawat[/eluser]
login_form.php is inside the controllers. Should I put it inside the views?
#4

[eluser]erik.brannstrom[/eluser]
Yes, all views go into the views folder.
#5

[eluser]Bhavani Shekhawat[/eluser]
Thanks man! That error is fixed now however I am getting this new error:

Fatal error: Call to undefined function form_open() in C:\xampp\htdocs\system\application\views\login_form.php on line 6
#6

[eluser]erik.brannstrom[/eluser]
You need to load the form helper, either in your controller or in the autoload file.
#7

[eluser]Bhavani Shekhawat[/eluser]
Since I am new to this thing I don't know how to do that?
#8

[eluser]erik.brannstrom[/eluser]
Read more on helpers on http://ellislab.com/codeigniter/user-guide/general/helpers.html.

Also, I'd recommend you check out some tutorials for CI and have a look through the user guide. It will make your life easier.
#9

[eluser]Bhavani Shekhawat[/eluser]
Thanks man I got that one! But what is this?

Fatal error: Call to undefined function anchor() in C:\xampp\htdocs\system\application\views\login_form.php on line 10
#10

[eluser]erik.brannstrom[/eluser]
Once again, you should really look through guides and especially the user guide. The anchor function is in the URL helper, which also needs to be loaded if you want to use it.




Theme © iAndrew 2016 - Forum software by © MyBB