Home > Backend Development > PHP Tutorial > How to generate a drop-down list of the past 100 years in php, generate a 100-year drop-down list in php_PHP tutorial

How to generate a drop-down list of the past 100 years in php, generate a 100-year drop-down list in php_PHP tutorial

WBOY
Release: 2016-07-13 09:46:03
Original
913 people have browsed it

How to generate a drop-down list of the past 100 years in php, how to generate a drop-down list of the past 100 years in php

The example in this article describes how to generate a drop-down list of the past 100 years in php. Share it with everyone for your reference. The details are as follows:

Year selection is often used in projects. This code automatically generates a drop-down list of the past 100 years starting from this year

<select name="year">
<&#63;php 
$years = range(date("Y"), date("Y", strtotime("now - 100 years"))); 
foreach($years as $year){ 
  echo'<option value="'.$year.'">'.$year.'</option>'; 
} 
&#63;> 
</select>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1035665.htmlTechArticleHow to generate a drop-down list of the past 100 years in php, php generates a 100-year drop-down list. The example of this article tells the story of php generating the past 100 years. drop-down list method. Share it with everyone for your reference. The details are as follows:...
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