Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Users and Dates (the Easy Way)
Jul 23, 2002 @ 11:51:49

Today, over on Evolt.org, there's a new piece posted that talks about using some of the built-in PHP functions to create and make dates from drop-down lists in a form. Using PHP for Date Processing in Forms suggests using the drop-down method for capturing a user-inputted date from a form rather than just a standard text box. Personally, I'd have to agree with them on this one. This could be a pain in the rear if you just allowed people to input anything they wanted in that form. Think of all the checking you'd have to do!
Anyway, this article gives you a nice little chunk of code that makes the drop-down lists for you when give the year range that you want to make it from, as well as the name of the field (so that if you have more than one on a page, you can use the same function and name them differently).

tagged:

Link:


Trending Topics: