Hello Everybody,
my problem is, I want to validate an email adresse with jquery. Not only the syntax but rather if the email is already registrated. 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>
And now the PHP Code:
<?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";
}
?>
I tried return TRUE/ return FALSE as well, but this displays "Email is registrated" all the time. json_encode didn't work as well.
Thanks a lot!