I am using jQuery Validate remote to check a php file and see if an email address is already in use. It works fine, however, I need it to redirect to a new page IF the email typed in already exists or "false". Below is the working remote validate script and simple php file. Again this works fine, just not sure how to redirect to a new page if the php script returns false.
$id = '0O1I0';
$id = preg_replace('/[i1]/i', '[i1]', $id);
$id = preg_replace('/[o0]/i', '[o0]', $id);
echo $id; // [i1][o0][i1][o0][o0]
...
mysqli_query($conn, "SELECT ... WHERE id REGEXP '$id'");
validate-email.php
rules: {
fullname: "required",
email: {
required: true,
email: true,
remote: {
url: "validate-email.php",
type: "post",
},
},
messages: {
email: {
required: 'Please enter a valid email address',
remote: 'Sorry, this email address is already in use',
}
}
Just to mention it one last time, the above php and jquery script work fine. Just need to redirect to a new page if the php result is echo 'false';
答案 0 :(得分:0)
I was able to redirect by simply adding the information from TheMintyMate
sys_eval()