dongrong8972 2012-11-17 06:11
浏览 131
已采纳

生日下拉列表

I want user to enter his birthday from dropdown menu during registration.I searched for code and got this

    <tr>
      <td><label>Birthday:</label></td>
      <td>
        <div class="input-container">
        <select name="month"><option value="0">Month:</option><?=generate_options(1,12,'callback_month')?></select>
        <select name="day"><option value="0">Day:</option><?=generate_options(1,31)?></select>
        <select name="year"><option value="0">Year:</option><?=generate_options(date('Y'),1900)?></select>
        </div>
      </td>
    </tr>

But this code is not working.Please show some error or provide with better dropdown menu code.

  • 写回答

2条回答 默认 最新

  • doumengmian1180 2012-11-17 06:23
    关注

    It could be that short_open_tag is disabled on your PHP setup. instead of

     <?= generate_options(
    

    you might need to code as

    <?php
     echo generate_options(
    

    then next step, We still need to know what error your page is showing. try this code on a new file called index2.php

    <?php
        error_reporting(E_ALL);
        define('INCLUDE_CHECK',1);
        require "functions.php";
    ?>
    <html>
    <body>
        <?=generate_options(1,12,'callback_month')?>
    

    below this are previous answers...

    What error did you get? if its undefined function generate_options , then you'll need to add that function in your page.

    Can you supply more detail so we can answer this? Can you also mention the page you took it from?

    if you got it from here http://tutorialzine.com/2009/08/creating-a-facebook-like-registration-form-with-jquery/ You'll need to copy the PHP code from that page as well.


    You'll need to add the php code either on top or at the bottom of the page.

    <?php
        function generate_options($from,$to,$callback=false)
    {
        $reverse=false;
    
        if($from>$to)
        {
            $tmp=$from;
            $from=$to;
            $to=$tmp;
    
            $reverse=true;
        }
      ......
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据