1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>날짜 선택 메뉴를 표시하고 싶을 때</title>
</head>
<body>
<div>
<?php
date_default_timezone_set('Asia/Seoul');
$from = (int) date('Y'); // 현재의 연도
$to = $from + 5;
echo '<select name="year">';
for($i = $from; $i <= $to; $i++)
{
echo "<option value=\"$i\">$i</option>";
}
echo "</select> 년";
?>
</div>
</body>
</html>
|

댓글 없음:
댓글 쓰기