CodeIgniter Forums
Unable to load the requested file: login_form.php - 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: Unable to load the requested file: login_form.php (/showthread.php?tid=30505)



Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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.


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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?


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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.


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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


Unable to load the requested file: login_form.php - El Forum - 05-17-2010

[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.