postbil.com Posted February 1, 2011 Share Posted February 1, 2011 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"> </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 More sharing options...
kenrbnsn Posted February 1, 2011 Share Posted February 1, 2011 "It doesn't work" doesn't tell us a lot. What is this code supposed to do? What is happening now. When you post code to this forum, please post it between tags. Ken Link to comment https://forums.phpfreaks.com/topic/226383-sending-timestamp-in-a-link/#findComment-1168464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.