Welcome Guest, Not a member yet? Register   Sign In
Date Of Birth Form
#1

[eluser]Sinclair[/eluser]
Hi,

I need to develop a form with the date of birth field(dropdown box). There is something developed for Codeigniter that can help with the problem of the days of the month? Days 30, 31, and 28 (or 29) when specific months of the year are selected?

Best Regards,
#2

[eluser]SpooF[/eluser]
PHP date function:
http://us3.php.net/manual/en/function.date.php
#3

[eluser]Unknown[/eluser]
[quote author="SpooF" date="1267762645"]PHP date function:
us3.php.net/manual/en/function.date.php[/quote]

I'am trying to find the exact same code as the person that started this thread. After looking through dozens of blogs and forums, all people do is post links to php.net.

I have spent close to 12 hours trying to find a solution to a simple question, and it seems that all people want to do is post links to php.net. Why cant you just answer the question? Is it too difficult to post a reply that someone new to php "might" be able to understand? php.net midas well be in greek or latin, because it is of no help what-so-ever. But for some reason its a favorite site to link to.

For crying out loud, how difficult can it be to build a form so someones birthdate can be entered into mysql? But for some reason, nobody can answer that question. The only replies I'am seeing are "go to php.net" - its like a big running joke or something. Lets send the noobs to php.net so they can get even "more" confused, lololol.
#4

[eluser]danmontgomery[/eluser]
You often see "go to php.net" replies because the answer is quite often found there. It should always be the first place you look.

From the page on php.net linked to in the above post:

Quote:t Number of days in the given month

which means:

Code:
echo date('t');

Will output the number of days in the current month. date() can be passed a unix timestamp as the second parameter, which is probably how it's most often used, simply for formatting. You can use mktime(), strtotime() (my preference), or a host of other functions to generate a unix timestamp. I might do something like:

Code:
echo date('t', strtotime('february'));

If I were feeling lazy, which would give me the number of days for today's date in february of this year. You could also do:

Code:
echo date('t', strtotime('february 2008'));

Which would give you the number of days in february of 2008 (29).

This is not really an ideal problem for PHP, because it's assumed the number of days will change when the month (and possibly year) are selected, which must be done with javascript.

There's also the alternative of using a javascript datepicker to avoid this problem alltogether, or always having the option of 31 days, and validating the date upon submission... Or just using text inputs.




Theme © iAndrew 2016 - Forum software by © MyBB