php - jQuery input form validate -


if have html form on validate works

<form method="post" action="" name="loginform" id="loginform">     <p><input type="text" name="user" id="user" "/></p>     <div class="forminputmistake"  id="erroremail"></div>        <p><input type="password" name="passwd" id="passwd" /></p>     <div class="forminputmistake"></div>     <input type="submit" name="login" id="login" value="login" />     <div class="forminputmistake"></div><!--here want show error "wrong password or user"--> </form> 

php-file usr.php

if(isset($_get['login']) && isset($_post['user']) &&          isset($_post['passwd']) && isset($_post['login'])) {     if($_post['user'] = "admin" && $_post['passwd'] == "admin") {         //successful log in         $_session['user'] = $_post['user'];         $_session['passwd'] = $_post['passwd'];         echo 'true';     } else {         echo 'false';     } } 

and jquery code, using validate-plugin made jörn zaefferer

$(document).ready(function(){     $("#loginform").validate({         ignore: ".ignore",         rules: { email: {...}, loginpasswd: {...} },         messages: { email: {...}, loginpasswd: {...} },         submithandler: function(form) {             $.post('usr.php?login', $(form).serialize(), function (data, textstatus) {                 if(data == 'true') {                     $('#loginform').hide();                 } else if(data == 'false') {                     //last forminputmistake - showing  "wrong password or user"??                 }             });         }     }); }); 

how validate errors coming server?

thank you

why write this

$_get['login']  

i think should write :

$_post['login'] 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -