Creating a login form in CodeIgniter based on Ion Auth library

farjam picture farjam · Mar 12, 2012 · Viewed 9.6k times · Source

I'm still learning my way around in CodeIgniter.

I'd like to create a login form in my codeigniter application based on Ion Auth library.

I have installed the library following the instruction and it works fine when navigating to auth/login, auth/create_user, auth/logout, etc...

However, I don't need a stand alone page for login, I'd like to embed the form in my homepage. When I use the sample provided login view in my homepage, I get the following errors:

  • Message: Undefined variable: message
  • Message: Undefined variable: identity
  • Message: Undefined variable: password

I realize that the above variables are not defined in my view, I just can't figure out where and how they should be defined and why is that they work fine in the provided sample that came with the library?

Answer

Nemanja Srećković picture Nemanja Srećković · Mar 12, 2012

Do you load proper libraries needed, in controller related to view where you want to embed login form, for example "form_validation" if you use form_input($message) for example, ... anyway you can avoid this by checking if $var is_set.