Novodk Posted August 23, 2013 Share Posted August 23, 2013 I got this calendar on my site and i made the dates clickable, but is it possible to make it so that when i click on the dates it opens a new site where it shows somthing like: <?php $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); ?> <?php if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); ?> <?php $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <tr> <td align="center"> <table cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7"><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></td> </tr> <tr> <td align="center">M</td> <td align="center">T</td> <td align="center">O</td> <td align="center">T</td> <td align="center">F</td> <td align="center">L</td> <td align="center">S</td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; $newdate = date('Y-m-j',$timestamp); $newdate = strtotime ( '-1 day' , strtotime ( $newdate ) ) ; $newdate = date('Y-m-j',$newdate); $today = date('j'); for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ){ echo "<tr>"; } if($i < $startday){ echo ("<td class='cell_txt'> </td>"); } else { if (($i - $startday + 1) == $today){ echo ("<td class='cell_today'><a href='#'>".($i - $startday + 1)."</a></td>"); } else { echo ("<td class='cell_txt'><a href='tftimer.php?day=". ($i - $startday + 1) . "&month=$cMonth&year=$cYear'>".($i - $startday + 1)."</a></td>"); } } if(($i % 7) == 6 ) { echo "</tr>\n"; } } ?> </table> </td> </tr> I hope someone can help Link to comment https://forums.phpfreaks.com/topic/281499-adding-data-to-a-calender/ Share on other sites More sharing options...
cyberRobot Posted August 27, 2013 Share Posted August 27, 2013 You sure can; where are you stuck? If you're unsure how to get the date information once the link is clicked, perhaps the following will help: http://php.net/manual/en/reserved.variables.get.php Link to comment https://forums.phpfreaks.com/topic/281499-adding-data-to-a-calender/#findComment-1446970 Share on other sites More sharing options...
Novodk Posted August 29, 2013 Author Share Posted August 29, 2013 You sure can; where are you stuck? If you're unsure how to get the date information once the link is clicked, perhaps the following will help: http://php.net/manual/en/reserved.variables.get.php That link was all i needed, thanks alot. Now i got another problem, i want to be able to add data from my database to a dropdown menu, lets call the table "Table1" row "Name" echo "<select name='username'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['username'] ."'>" . $row['username'] ."</option>"; } echo "</select>"; That works fine, but if i want to add more data from another table called "Table2" row "Age" how do i do that, i think my problem is how to setup my Recordset Link to comment https://forums.phpfreaks.com/topic/281499-adding-data-to-a-calender/#findComment-1447356 Share on other sites More sharing options...
Novodk Posted August 29, 2013 Author Share Posted August 29, 2013 <select name="Navn" id="Navn"> <?php do { ?> <option value="<?php echo $row_timer['Navn']?>"><?php echo $row_timer['Navn']?></option> <?php } while ($row_timer = mysql_fetch_assoc($timer)); $rows = mysql_num_rows($timer); if($rows > 0) { mysql_data_seek($timer, 0); $row_timer = mysql_fetch_assoc($timer); } ?> </select> Im using Dreamweaver and there is an automatic thing that adds that piece of code, it works okay, but it shows each entry from the database twice in the dropdown menu, anyone that can figure out why? Link to comment https://forums.phpfreaks.com/topic/281499-adding-data-to-a-calender/#findComment-1447376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.