doqw89029 2016-01-24 15:54
浏览 20
已采纳

too long

i have this code:

<tr><td>Data expirare:</td><td><?=date_chooser("date",date("Y-m-d"),0)?></td></tr>

It is working properly, but at the moment I look from 1920 until 2050 and I want to show me only of certain pending and the next five years.

  • 写回答

1条回答 默认 最新

  • du31992 2016-01-24 16:03
    关注

    I assume you are using the date_chooser() algorithm from this SO post: How to jump to anchor on submit - not to top of page or this internet page: http://ideone.com/Ab0cLD

    I adapted a small part of the code by adding two variables: $from_year and $to_year. They do now define the range of the years in your drop down. You can the adapt the value of the variables to your needs.

    $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>";
       }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)