Home > Backend Development > PHP Tutorial > Create date selection box using php

Create date selection box using php

巴扎黑
Release: 2023-03-02 16:42:01
Original
3900 people have browsed it

<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>
Copy after login

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