Reputation: 5
Can someone tell me why this is not working to validate this email.
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
echo 'Nope';
}
<div class="join input-group">
<a class="join_topic">Email *</a>
<input type="text" name="Email" id="Email" value="<?php echo escape(Input::get('Email')); ?>" class="form-control">
</div>
When i press register nothing happend when i type "123" as the email..
Upvotes: 0
Views: 46
Reputation: 384
"123" is not a valid email address by the specifications of the FILTER_VALIDATE_EMAIL filter which is why you're not seeing a response. Enter "[email protected]" and it should work fine. You might also want to and an else conditional while you're at it.
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
echo 'Valid Email';
}else{
echo 'Not Valid';
}
Upvotes: 0