利用php创建日期选择框

巴扎黑
发布: 2023-03-02 16:42:01
原创
3883 人浏览过

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

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板