douyo770657 2012-04-14 04:22
浏览 146
已采纳

如何在下一页显示日期?

I really need some help about how to pass returndate value in next page(save.php). the value that i cant' pass was under this "(input type='hidden' name='retDate[$i]' value='$retDate')". I'm using calendar datepicker at this website(http://www.triconsole.com/php/calendar_datepicker.php). Appreciate if someone can help me about this and do refer below for my coding.

under "result.php"

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>
    <h1>RESULT </h1>
    <p><b>Escalation Date : </b>
    <?php echo $_POST["date1"] ?> until <?php echo $_POST["date2"] ?>
    </p>
    <?php 
                 ......
            //Select database
            $selected = mssql_select_db($myDB, $link)
            or die("Couldn't open database $myDB");

            //declare the SQL statement that will query the database
            $query = "SELECT....."; 

        //execute the SQL query and return records
        if ($result = mssql_query($query, $link)){
            echo "<form name='form1' method='post' action='save.php'>";
            echo "<table border='1'>
            <tr>
            <th>batch_exception_id</th>
            <th>batch_id</th>
            <th>process_date_time</th>
            <th>Return Date</th>
            </tr>";
            $i=0;
            while ($row = mssql_fetch_assoc($result)) {   
                $rDate = $row['ReturnDate'];
                $beID = $row['batch_exception_id'];                         
                $proc_dt = $row['process_date_time'];
                echo "<tr>";
                echo "<td>" . $beID . "<input type='hidden' name='beID[$i]' value='$beID'/></td>";
                echo "<td>" . $row['batch_id'] . "</td>";
                echo "<td>" . $proc_dt . "<input type='hidden' name='procDT[$i]' value='$proc_dt'/></td>";

                if($rDate == ""){
                    echo "<td>";    
                            $f_name="retDate[".$i."]";    
                    $myCalendar = new tc_calendar($f_name, true, false);      
                    $myCalendar->setIcon("calendar/images/iconCalendar.gif");     
                    $myCalendar->setDate(date('d'), date('m'), date('Y'));    
                    $myCalendar->setPath("calendar/");    
                    $myCalendar->setYearInterval(2000, 2020);     
                    $myCalendar->dateAllow('2000-01-01', '2020-01-01');   
                    $myCalendar->setDateFormat('j F Y');      
                    $myCalendar->setAlignment('left', 'bottom');      
                    //$myCalendar->setSpecificDate(array("", "0", "0"), 0, 'year');   
                    //$myCalendar->setSpecificDate(array("0", "0"), 0, 'month');      
                    //$myCalendar->setSpecificDate(array("0"), 0, '');    
                    $myCalendar->writeScript();
                    echo "<input type='hidden' name='retDate[$i]' value='$retDate'/>";
                    //echo "<input type='hidden' name='retDate[$i]' value='".$myCalendar->getDate()."'/>";    
                    $i++;       
                    echo "</td>";
                } else {
                    echo "<td>" . $rDate . "</td>";
                }
                echo "</tr>";       
            }           

            echo "</table><br/>";
            echo "<input type='button' value='<<' onclick='history.back(-1)'/>";
            echo "<input type='hidden' name='total_rec' value='$i'/>";          
            echo "<input type='submit' value='Save'/>";         
            echo "<input type='button' value='Print' onclick='window.print()'/>";
            echo"</form>";
        }

        //close the connection
        mssql_close($link);     
    ?><br/>                 
</body>

enter image description here

under "save.php"

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>       
    <?php 
        //$ReturnDate = $_POST["rDate"];
        $arrbeID = $_POST["beID"];
        $tot_rec = $_POST["total_rec"];
        $arrprocDT = $_POST["procDT"]; 
        $arrretDate = $_POST["retDate"]; 

        for ($i=0; $i<$tot_rec;$i++) {
            echo "Batch Esc. ID: ".$arrbeID[$i]." 
                | Proc. DateTime: ".$arrprocDT[$i]."
                | Ret. Date: ".$arrretDate[$i]."
                <br>";
        }       

    ?><br/>
</body>

enter image description here

  • 写回答

2条回答 默认 最新

  • douyan1244 2012-04-19 02:00
    关注

    solution:-

    Put below sript under head in Result.php

        <link rel="stylesheet" title="Style CSS" href="cwcalendar.css" type="text/css" media="all" />
        <script type="text/javascript" src="calendar.js"></script>
    

    Add below code under body in Result.php

         $date="date[".$i."]"; 
    echo "<input type='text' name='date[$i]' id='$date' value=' ' onclick=\"fPopCalendar('".$date."')\">";  
    

    script reference: http://codetale.com/2009/06/21/javascript-calendar-widget-108/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题