I am toying with validations and all is going swell except I am not really liking the FILTER_VALIDATE_URL PHP filter, or I am not using it correctly. This type of input will validate:
www.mysite (notice no .com)
I would like for this to work:
www.mysite.com
mysite.com
Here is the code I am using now..
if (empty($web)) {
$webError = '<p class="error">Website Is Required</p>';
}
else if (filter_var($web, FILTER_VALIDATE_URL) === FALSE) {
$webError = '<p class="error">Please Enter A Valid URL</p>';
}