Jump to content

date input validation


asherinho

Recommended Posts

wats up friends?,I am having a problem with validation.I created a form which requires the user to enter date and the date field in the database accepts only these formats year-month-day, year.month.day or year/month/day.Below are the codes i used,the problem is if the user enters the date in either of these format day-month-year, day.month.year or day/month/year the error message is not displayed and the values are sent as null values to the database.Any one to assist me please

 

if(!eregi("^[0-9]+[.\-\/]+[0-9]+[.\-\/]+[0-9]+$",$datesent)){the date format is not one of the recomended which are:- year.month.day/year.month.day/year-month-day</p>"; exit;}

Link to comment
https://forums.phpfreaks.com/topic/63504-date-input-validation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.