doubledee Posted January 16, 2012 Share Posted January 16, 2012 What is the best way to check for a Date in a Form? I see there is a CheckDate() function, but how does that know what format the Date is in? Should I use a Regular Expression? My Form Field is just a Text Box... Thanks, Debbie Link to comment https://forums.phpfreaks.com/topic/255106-best-way-to-check-for-date/ Share on other sites More sharing options...
Pikachu2000 Posted January 16, 2012 Share Posted January 16, 2012 The manual explains how checkdate works. A text field is very error-prone way to accept a date from a form. You should use a jQuery datepicker, and as a backup, <select> fields in a <noscript> block. Link to comment https://forums.phpfreaks.com/topic/255106-best-way-to-check-for-date/#findComment-1308046 Share on other sites More sharing options...
doubledee Posted January 16, 2012 Author Share Posted January 16, 2012 The manual explains how checkdate works. A text field is very error-prone way to accept a date from a form. You should use a jQuery datepicker, and as a backup, <select> fields in a <noscript> block. Since this is an Admin Form, I guess I'll have to trust myself for now. (Don't know JavaScript nor do I have any desire to learn it anytime soon!) I was hoping there was a simple solution using a PHP Function or Regex?! Thanks, Debbie Link to comment https://forums.phpfreaks.com/topic/255106-best-way-to-check-for-date/#findComment-1308048 Share on other sites More sharing options...
Pikachu2000 Posted January 16, 2012 Share Posted January 16, 2012 You could always forget about the datepicker, and just use <select> fields. Link to comment https://forums.phpfreaks.com/topic/255106-best-way-to-check-for-date/#findComment-1308049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.