Heim > Artikel > Backend-Entwicklung > CI框架,表述提交没有反应,这是为什么呢
CI框架,表达提交没有反应,这是为什么呢
这是view里的表单的代码块
<br /> <form class="login active" action="http://localhost/~chrisfu/CI/index.php/login/checklogin" method="post"><br /> <h3>Login</h3><br /> <div><br /> <label>Username:</label><br /> <input type="text" name="name"/><br /> <span class="error">This is an error</span><br /> </div><br /> <div><br /> <label>Password: <a href="forgot_password.php" rel="forgot_password" class="forgot linkform">Forgot your password?</a></label><br /> <input type="password" name="psword"/><br /> <span class="error">This is an error</span><br /> </div><br /> <div class="bottom" ><br /> <div class="remember"><input type="checkbox" /><span>Keep me logged in</span></div><br /> <input type="submit" value="Login" name="submit"></input><br /> <a href="register.php" rel="register" class="linkform">You don't have an account yet? Register here</a><br /> <div class="clear"></div><br /> </div><br /> </form><br />
<br /> <?php<br /> class Login extends CI_Controller{<br /> function index(){<br /> $this->load->view('index');<br /> }<br /> function checklogin(){<br /> $this->load->model('test_m');<br /> $user=$this->test_m->user_select($_POST['name']);<br /> <br /> if($user){<br /> if($user[0]->upass==$_POST['pword']){<br /> echo "password right";<br /> $this->load->library('session');<br /> $arr=array('uid'=>$user[0]->uid);<br /> $this->session->set_userdata($arr);<br /> echo "<br>";<br /> echo $this->session->userdata('uid');<br /> }else{<br /> echo "password wrong";<br /> }<br /> }else{<br /> echo "user not exist";<br /> }<br /> }<br /> }<br /> <br /> ?><br />