I just can not find how to implement the three select boxes of the date of birth, or rather the generation of data in them. Please help.
|
2 answers
<?php // Число echo "<select name='sel_date'>"; $i = 1; while ($i <= 31) { echo "<option value='" . $i . "'>$i</option>"; $i++; } echo "</select>"; // Месяц echo "<select name='sel_month'>"; $month = array( "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" ); foreach ($month as $m) { echo "<option value='" . $m . "'>$m</option>"; } echo "</select>"; // Год echo "<select name='sel_year'>"; $j = 1920; while ($j <= 2020) { echo "<option value='" . $j . "'>$j</option>"; $j++; } echo "</select>"; ?> |
Maybe you'd better use a jquery calendar? Look here for a datepicker .
- It looks very effective, I just would not want to use jquery UI. - intranet
- Then you have to write your JavaScript, unfortunately I have never done this, otherwise I would share it ready. - Farhod
- I just saw it implemented when php fills dates, but now I have not found it anywhere. - intranet
|