My problem is that I want to validate an email address with jquery. Not only the syntax but rather if the email is already registered. There are some tutorials but they are not working! At first the Jquery Code:
<script id="demo" type="text/javascript">
$(document).ready(function() {
// validate signup form on keyup and submit
var validator = $("form#signupform").validate({
rules: {
Vorname: {
required: true,
minlength: 3
},
Nachname:{
required: true,
minlength: 4
},
password: {
required: true,
minlength: 5
},
password_confirm: {
required: true,
minlength: 5,
equalTo: "#password"
},
Email: {
required: true,
email: true,
type: "POST",
remote: "remotemail.php"
},
dateformat: "required",
...
</script>
Ve şimdi PHP-Kodu:
<?php
include('dbsettings.php');
$conn = mysql_connect($dbhost,$dbuser,$dbpw);
mysql_select_db($dbdb,$conn);
$auslesen1 = "SELECT Email FROM flo_user";
$auslesen2 = mysql_query($auslesen1,$conn);
$registered_email = mysql_fetch_assoc($auslesen2);
$requested_email = $_POST['Email'];
if( in_array($requested_email, $registered_email) ){
echo "false";
}
else{
echo "true";
}
?>
Ben de FALSE döndürür / DOĞRU dönmek çalıştı, ancak bu her zaman "e-posta kayıtlı" görüntüler. json_encode da işe yaramadı.
Thanks a lot!