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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.