+ 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?
6 Respuestas
+ 5
You could use <input type="date">
+ 4
+ 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;
}
+ 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 ☺
+ 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.
0
es muy fácil amigo presta atención