+ 4

Help here 👇

when making a form in html where one has to select the year of birth is there a way to automate the values instead of writing all those values for example from year 1920-2018?

17th Apr 2018, 12:39 PM
Joseph Mbugua
Joseph Mbugua - avatar
6 Respuestas
+ 5
You could use <input type="date">
17th Apr 2018, 12:45 PM
Zeke Williams
Zeke Williams - avatar
+ 4
Thanks guys, you really saved me and my time Zeke Williams, Xan and Niush sitaula
17th Apr 2018, 1:01 PM
Joseph Mbugua
Joseph Mbugua - avatar
+ 3
Yes. PHP. This is probably the older method. Go with the other suggestions. This code us useful for populating option menus with other data though. https://code.sololearn.com/wqBEj3P5Nq0E/?ref=app function option_menu() { $html = "<select>"; for ($year = 1920; $year <= 2018; $year++) { $html .= '<option id="' . $year . '">' . $year . '</option>'; } $html .= "</select>"; return $html; }
17th Apr 2018, 12:46 PM
Emma
+ 2
JoeMbugua Go with the type="date" solution for sure. I don't think that was available when I first learned HTML back in the day! It's a much better solution. Good luck with your project ☺
17th Apr 2018, 1:03 PM
Emma
+ 2
Niush sitaula Apologies for my outdated solution. Back in the day we had to create that all ourselves. I must brush up on the updates! It's great learning off others on here.
17th Apr 2018, 1:19 PM
Emma
0
es muy fácil amigo presta atención
17th Apr 2018, 6:01 PM
Brayan Caceres Torres
Brayan Caceres Torres - avatar