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; Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.