I have three select'a. In the first: day. In the second: a month. In the third: a year. I would like these selects to be entered into the database as a single integer (date). But no matter how I tried - it does not work. This thing is needed for registration (date of birth of the user).

How do these three select'a merge into one to bring in the database? Or just to score and remove these selects?

Closed due to the fact that the essence of the issue is not clear to the participants of Kromster , Streletz , zRrr , user194374, Cerbo 26 Jun '16 at 21:03 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    why not use any datepicker component? - Bald

1 answer 1

$_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'] 

The easiest option. The main values ​​of selects are stored in the correct format, with the current zero in front.

  • one
    The only thing that will then be problematic to compare, if you write just with the form of a string. Perhaps there is some method (I do not remember already), which string leads to the date format. And then this date should be recorded in the field of type date. - smellyshovel
  • There will be no problem, the date will be stored in the database as follows, in the correct Mysql date format. - quaresma89 4:05 pm