co robię źle?
plik user.php
include 'config.php';
$nick=$_POST['login'];
$zapytanie=mysql_query("SELECT nick FROM users WHERE nick='$nick'"); if($ile>0)
{echo '{"success":false,"error":"username_already_exists"}';} else { echo '{"success":true}';}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rejestracja</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
$(document).ready(function(){
$("#rejestracja").validate({
rules: {
login: {
required: true,
minlength: 4
},
haslo1: {
required: true,
minlength: 5
},
haslo2: {
required: true,
equalTo: "#haslo1"
},
email: {
required: true,
email: true
}
},
messages: {
login:{
required: "Proszę wpisać login!",
minlength: "Minimalne długość to 4 znaki!"
},
haslo1:{
required: "Proszę wpisać hasło",
minlength: "Minimalna długość to 5 znaków!"
},
haslo2:{
required: "Proszę wpisać hasło",
equalTo: "Hasła są różne!"
},
email:{
required: "Wprowadź adres e-mail",
email: "Wprowadź poprawny adres e-mail"
}
},
success: function(label) {
label.html(" ").addClass("sprawdzony");
$.post('user.php',{login: zmienna_z_loginem},function(data) {
if (data == 1) {
$('cos_gdzies_do_wyswietlenia').text('Podany nick jest wolny');
} else {
$('cos_gdzies_do_wyswietlenia').text('Podany nick jest zajety');
}
});
}
});
});
</script>
</head>
<body>
<form id="rejestracja" action="" method="post">
<p>
<label for="login">Login:</label>
<input type="text" name="login" id="login" />
</p>
<p>
<label for="haslo1">Hasło:</label>
<input type="password" name="haslo1" id="haslo1" />
</p>
<p>
<label for="haslo2">Powtórz hasło:</label>
<input type="password" name="haslo2" id="haslo2" />
</p>
<p>
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
</p>
<p>
<input name="dodaj" class="wyslij" type="submit" value="Dodaj" />
</p>
</form>
</body>
</html>
pomoże ktoś?
pomoże ktoś?