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 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败