Home >Backend Development >PHP Tutorial > 循环出来的Select选项有关问题

循环出来的Select选项有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:37:38866browse

循环出来的Select选项问题

选择月份:<br />
		<select name="month"><br />
			<?php <br />
			for($i="1"; $i<="12"; $i++){<br />
				if($i<10){<br />
					echo "<option>0".$i."月</option><br>";<br />
				}else{<br />
					echo "<option>".$i."月</option><br>";<br />
				}<br />
			} <br />
			?><br />
		</select>

这个月份是通过For循环出来的,默认是选择1月份,当选择其它月份再点提交后,又显示回1月份了,有什么办法可以停留在当前选择的月份呢?

select php
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