(php)關於select提交表單後顯示所提交的值為預設值

來源:互聯網
上載者:User

<?php
$accountcode=$_GET['accountcode'];
$costenter=$_GET['costenter'];
$year=$_GET['year'];
$month=$_GET['months'];
?> 
 <table>
  
  <tr>
   
   <td>年份:<select name="year">                          
        <option value="2016">2016</option>       
                       </select></td>
   <td>月份:<select name="months">
                       <option value="" <? if($month==""){ echo  "selected='selected'";} ?>></option>
        <option value="1" <? if($month=="1"){ echo  "selected='selected'";} ?>>1</option>
        <option value="2"<? if($month=="2"){ echo  "selected='selected'";} ?>>2</option>
        <option value="3" <? if($month=="3"){ echo  "selected='selected'";} ?>>3</option>
        <option value="4" <? if($month=="4"){ echo  "selected='selected'";} ?>>4</option>
        <option value="5" <? if($month=="5"){ echo  "selected='selected'";} ?>>5</option>
        <option value="6" <? if($month=="6"){ echo  "selected='selected'";} ?>>6</option>
        <option value="7" <? if($month=="7"){ echo  "selected='selected'";} ?>>7</option>
        <option value="8"<? if($month=="8"){ echo  "selected='selected'";} ?>>8</option>
        <option value="9" <? if($month=="9"){ echo  "selected='selected'";} ?>>9</option>
        <option value="10" <? if($month=="10"){ echo  "selected='selected'";} ?>>10</option>
        <option value="11" <? if($month=="11"){ echo  "selected='selected'";} ?>>11</option> 
        <option value="12" <? if($month=="12"){ echo  "selected='selected'";} ?>>12</option> 
                       </select></td>

</table>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.