How can I create a day drop-down that shows the correct number of days depending on the Month selected in other drop-down?
I dont want the user to enter a date of birth.
Can this be done with any built in functions in the Javascript or Php Dynamically?
Or do I have to write separate functions for each month?
No, there are no built-in Javascript or PHP functions to dynamically manipulate an HTML “day in month” dropdown.
However, there are date functions in both languages (PHP · Javascript) that can tell you how many days are in a given month.
I recommend using Javascript to manipulate the children of your “day”
<select />element accordingly, when there is a change in selection in your “month”<select />element.Or save yourself the trouble and use the datejs library.
Good luck!