Jump to content

adding data to a calender


Novodk

Recommended Posts

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: 

ibTOWC9.jpg

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

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


<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?

Edited by Novodk
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.