Hello, in this video, I am going to show you how to validate an email address using the filter var function really simple, but it can be quite complex when you're trying to validate an email. So there's built in functionality, which is great for us. So the first thing I actually want to do is duplicate some of the stuff that we've got because I want to add a, you know, a do like a multi chord. I don't think I need to, ah, I don't think I need to do a new field, I will need to just comment out instead of doing this check, I will do a email address check instead. So you'll be on basically sort of you know, check in for email. And not just that I will actually rename it also.
Email era. Also email by email, email, email them to email. And the next thing I'm going to do is go down here update a few things email and also to make sure this is still working and all of this Okay, sounds good. Okay, so we want to validate the format to do this really simple. If so, if the format is not valid or not filter underscore var, so basically this checking if the fill of the format isn't valid, we are checking against the email variable and all we have to do is filter on this Score lovely date on the score email. So as you can see a few different things.
You can do it based on domain you can do it based on a few others stuff like MAC address, but wood and URL and the gonna email. So email and all we have to do now if this is not valid email error equals this is an invalid email I'll save that run out empty for just started my name that is not valid. And let's say for talking about company's email list that's fine for the contact list they actually contact me copy that that's invalid because we need dot something up a dot code UK for example, that will be valid. So that is how you validate email simple stuff. If you have any questions, feel free to pop me a message and as usual, I look forward to seeing you in the next video.