2016-01-24 133 views

回答

0

我假設你正在使用的date_chooser()算法從這個SO職位:How to jump to anchor on submit - not to top of page或此互聯網網頁:$from_year$to_yearhttp://ideone.com/Ab0cLD

我加入兩個變量調整的代碼的一小部分。他們現在確定下拉列表中的年份範圍。您可以根據需要調整變量的值。

$chooser.="<select name='".$name."year'>"; 
$from_year = 1950 
$to_year = date("Y") + 5 
    for($i=$from_year;$i<=$to_year;$i++) 
    { 
     if($i==$year) $selected='selected'; 
     else $selected=''; 
     $chooser.="<option $selected>$i</option>"; 
    } 
+0

偉大的人!多謝! –

相關問題