利用php创建日期抉择框

WBOY
Release: 2016-06-13 13:06:41
Original
1145 people have browsed it

利用php创建日期选择框

<form action="" method="post" >
<?php
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$days = range(1,31);
$years = range(2008,2018);
echo '<select name="month" >';
foreach ($months as $key => $value) {
	echo "<option value=\"$key\">$value</option>";
}
echo '</select>';
echo '<select name="day" >';
foreach ($days as $value) {
	echo "<option value=\"$value\">$value</option>";
	}
echo '</select>';
echo '<select name="year" >';
foreach ($years as $value) {
	echo "<option value=\"$value\">$value</option>";
}
echo '</select>';
?>
</form>
Copy after login

1 楼 ly365 2011-06-02  
方法不错,但是数据的验证比较麻烦。不是每个月都是 31天的

2 楼 bbs_ld 2011-11-29  
一楼说的对啊。如何解决呢?? 利用php创建日期抉择框 高手大人 利用php创建日期抉择框

3 楼 wangshaofei 2011-12-03  
bbs_ld 写道
一楼说的对啊。如何解决呢?? 利用php创建日期抉择框 高手大人 利用php创建日期抉择框
 利用php创建日期抉择框
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template