I'm using the ereg function to check the validity of a date - I realise my ereg isn't quite perfect it'll pass but
when I enter just m/d when I'm looking for m/d/y, it'll automatically enter the current year or if I enter d/y d will be read as month and enter as the 1st/m/year and m/y will do the same thing
This is my code:
if (!ereg ("([0-3]{1,2}).([0-9]{1,2}).([0-9]{4})", $_POST[BirthDate], $regs)) //works with . and / but not -
{ echo "Please enter a correct date";
pageRedirect('index.html');}
Could someone suggest improvements please?