开发者

How/where to pass params from a view to a controller in CodeIgniter?

I'm new to PHP and Codeigniter; I did a login page without using Codeigniter, and it worked. Now I'm trying to do it under the MVC design and Codeigniter.

I have a controller which directs to the view of the login page. Then I submit - but I don't understand how and where to send the user name and password I go开发者_开发百科t, to handle it.

I know it should be sent to a controller - but i don't understand how.

Should i just do this in my login view?

<form name="loginForm" method="post" action="/controllers/checklogin.php" id='loginForm' dir="rtl">

Is there a better - or more elegant way to pass the params for a controller that will handle the login?


In codeigniter, when a user is seeing the page generated by the view, they aren't directly accessing the view file. Instead they are accessing the controller which is rendering the view. When you are taking POST and GET variables in, you should post them to the controller (which should handle all validation and error handling).

Here's an example I think is easy to follow:

http://jrtashjian.com/2009/02/simple-login-form-with-codeigniter/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜