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
WBOYOriginal
2016-07-13 09:46:03921browse

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>

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:...
Statement:
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