Blogger Information
Blog 35
fans 0
comment 1
visits 42687
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0417追加select循环遍历
魏先生的博客
Original
602 people have browsed it
<meta charset="UTF-8"/>
<?php

$year = range(1980,2020);
echo '<select name="年">';
foreach(  $year as $values   ){
    echo '<option name="年" >'.$values.' 年</option>';
}
echo '</select>';


echo '<br>';
$month = range(1,12);
echo '<select name="月">';
    foreach($month as $values){
        echo '<option value="'.$values[5].'">'.sprintf("%02d",$values).'月份</option>';
    }
echo '</select>';    

echo '<br>';
$month = range(1,31);
echo '<select name="日">';
    foreach($month as $values){
        echo '<option value="'.$values.'">'.sprintf("%02d",$values).'日</option>';
    }
echo '</select>';   
 
 今天学到一个函数 range();范围值,函数.
 sprintf("%02d");月数不够两位数 自动前面加0
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post