Categories
HTML5

HTML5 validation

I decided to use the HTML5 <input><datalist> on a View in my CakePHP project, and was super surprised to see that there is no way of restricting the text in the <input> to the values in the <datalist>. I have a basic edit form in the database application I am working on. I wanted a […]

Categories
PHP

E-mail address validation

Hoo boy we have to do this all the time and a quick Google tells me everyone has their favorite little tricks. Some even work. Here are the results of an exercise in e-mail validation using two different PHP options, namely: filter_var($email, FILTER_VALIDATE_EMAIL)); preg_match(‘/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i’, $email); See demo page here…