Jump to content

sending timestamp in a link


postbil.com

Recommended Posts

Hello Phpfreaks.

I had created a calender, but I tryed to send a timestamp, in a link and print the timestamp under the calendar. But it dosent work..

can somebody please help me !!

 

<?php

 

    function calendar (){

 

// selecct the current timezone

 

        date_default_timezone_set('Europe/Paris'); 

 

// accept incoming URL parameter

 

        $timestamp = (isset($_GET['t'])) ? $_GET['t'] : time();

 

        $tsDM = (isset($_GET['tsDM']));

 

        echo $tsDM;  //test

 

// determine useful aspects of the requested month

 

        list($month, $day, $year) = explode('/', date('m/d/Y', $timestamp));

 

        $first_day_of_month = date('w', mktime(0, 0, 0, $month, 7, $year));

 

        $total_days = date('t', $timestamp);

 

 

 

// output table header

 

        echo '<h8>';

 

        echo '<table id="calendar">';

 

            echo '<tr id="calendar_header"><th colspan="7">';

 

                echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?t=' .

 

                    strtotime('-1 month', $timestamp) . '"><</a>  ';

 

                echo date('F', $timestamp) . ' ' . $year;

 

                echo '  <a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?t=' .

 

                    strtotime('+1 month', $timestamp) . '">></a>';

 

            echo '</th></tr>';

 

            echo '<tr><th>Man</th><th>Tir</th><th>Ons</th><th>Tor</th><th>Fre</th>' .

 

                '<th>L�r</th><th>S�n</th></tr>';

 

 

 

// output date cells

 

            $current = 1;

 

            while ($current <= $total_days){

 

                echo '<tr class="calendar_dates">';

 

                for ($i = 0; $i < 7; $i++){

 

                    if (($current == 1 && $i < $first_day_of_month) ||

 

                        ($current > $total_days)){

 

                            echo '<td class="empty">&nbsp</td>';

 

                            continue;                 

 

                    }

 

// find the correct timestamp at day.

 

                    $tsDMY = urlencode(mktime(0, 0, 0, $month, $current, $year));

 

                    $tsDM = urlencode(mktime(0, 0, 0, $month, $current, 0));

 

// Print the actual date

 

                    echo "<td>";

 

                        echo '<center><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?tsDM=$tsDM">' . $current . '</a></center>';

 

                    echo "</td>";

 

                    $current++;

 

                }

 

                echo '</tr>';

 

            }

 

        echo '</table>';

 

        echo '</h8>';

 

        echo $tsDM;

Link to comment
https://forums.phpfreaks.com/topic/226383-sending-timestamp-in-a-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.