Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Created July 11, 2016 08:16
Show Gist options
  • Save MikSDigital/bfbc07eec6b5580e4392bf433f7c31ce to your computer and use it in GitHub Desktop.
Save MikSDigital/bfbc07eec6b5580e4392bf433f7c31ce to your computer and use it in GitHub Desktop.
<?php
// $namepreg = '/^[a-zA-Z \'\-]+$/';
$namepreg = '/^[a-zA-ZöüõäÕÄÖÜñÑĀāČčĒēĪīŠšŪūŽž \'\-]+$/'; // Latvian letters
$mailpreg = '/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i';
$phonepreg = '/^[\+0-9]+$/';
if (!preg_match($namepreg, htmlspecialchars($firstName)))
{
$errorFields[] = 'firstName';
}
if (!preg_match($namepreg, htmlspecialchars($lastName)))
{
$errorFields[] = 'lastName';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment