Jump to content

[SOLVED] ajax and php calendar


chriscloyd

Recommended Posts

okay first off i spelt something wrong and im okay its a test

 

I need help

i have a calendar script im working on

http://thekcdesign.com/myCalander/test.php

 

****THIS IS WHAT IM TRYING TO DO****

if someone can help me i want to click on a day and it pop up on the right hand side the day and then get informaton from a php about whats happening on the day

 

heres my code

<link href="mycalendar.css" rel="stylesheet" type="text/css">
<script src="scripts/utils.js" type="text/javascript"></script>
<script src="scripts/validation.js" type="text/javascript"></script>
<?php
$date =time ();
$day = date('d', $date);
if (isset($_GET['month'])) {
$month = $_GET['month'];
} else {
$month = date('m', $date);
}
if (isset($_GET['year'])) {
$year = $_GET['year'];
} else {
$year = date('Y', $date);
}
$first_day = mktime(0,0,0,$month, 1, $year);
$title = date('F', $first_day);
$tday = date('d', $date);
$tmonth = date('m', $date);
$tyear = date('Y', $date);
$tfirst_day = mktime(0,0,0,$tmonth, 1, $tyear);
$ttitle = date('F', $tfirst_day);
$day_of_week = date('D', $first_day);
switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}
$days_in_month = cal_days_in_month(0, $month, $year);
?>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style><table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td><table width="714" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td><table width="714" border="0" cellspacing="1" cellpadding="0">
            <tr>
              <td><table width="712" border="0" cellspacing="1" cellpadding="0">
                  <tr>
                    <td width="72"><img src="images/previous.jpg" width="72" height="72"></td>
                    <td align="center"><form name="form1" method="post" action="">
                        <select name="menu1" class="selectmy" onChange="MM_jumpMenu('parent',this,0)">
                          <option value="?month=01&year=<?=$year;?>" <?php if ($month == '01') { echo 'selected'; } ?>>January</option>
                          <option value="?month=02&year=<?=$year;?>" <?php if ($month == '02') { echo 'selected'; } ?>>February</option>
                          <option value="?month=03&year=<?=$year;?>" <?php if ($month == '03') { echo 'selected'; } ?>>March</option>
                          <option value="?month=04&year=<?=$year;?>" <?php if ($month == '04') { echo 'selected'; } ?>>April</option>
                          <option value="?month=05&year=<?=$year;?>" <?php if ($month == '05') { echo 'selected'; } ?>>May</option>
                          <option value="?month=06&year=<?=$year;?>" <?php if ($month == '06') { echo 'selected'; } ?>>June</option>
                          <option value="?month=07&year=<?=$year;?>" <?php if ($month == '07') { echo 'selected'; } ?>>July</option>
                          <option value="?month=08&year=<?=$year;?>" <?php if ($month == '08') { echo 'selected'; } ?>>August</option>
                          <option value="?month=09&year=<?=$year;?>" <?php if ($month == '09') { echo 'selected'; } ?>>September</option>
                          <option value="?month=10&year=<?=$year;?>" <?php if ($month == '10') { echo 'selected'; } ?>>October</option>
                          <option value="?month=11&year=<?=$year;?>" <?php if ($month == '11') { echo 'selected'; } ?>>November</option>
                          <option value="?month=12&year=<?=$year;?>" <?php if ($month == '12') { echo 'selected'; } ?>>December</option>
                        </select>
                         
                        <select name="menu2" class="selectmy" onChange="MM_jumpMenu('parent',this,0)">
                          <?php 
	$ynum = $year + 50;
	for ($y = 1980; $y < $ynum; $y++) { 
	echo '<option value="?month='.$month.'&year='.$y.'" ';
	if ($year == $y) { echo "Selected"; }
	echo '>'.$y.'</option>';
	}
	?>
                        </select>
                    </form></td>
                    <td width="72" align="right"><img src="images/next.jpg" width="72" height="72"></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td ><table width="736" border="0" cellspacing="0" cellpadding="0">
                  <tr class="calendarbgtop">
                    <td class="daynames">Sunday</td>
                    <td class="daynames">Monday</td>
                    <td class="daynames">Tuesday</td>
                    <td class="daynames">Wednesday</td>
                    <td class="daynames">Thursday</td>
                    <td class="daynames">Friday</td>
                    <td class="daynames">Sunday</td>
                  </tr>
                  <tr>
                    <th colspan="7"><table width="100%" border="0" cellspacing="1" cellpadding="0" class="calendarbg">
                        <tr >
                          <?php
		$day_count = 1;
		while ( $blank > 0 )
		{
		echo "<td></td>";
		$blank = $blank-1;
		$day_count++;
		}
		$day_num = 1;
		while ( $day_num <= $days_in_month )
		{
		if ($day_num == $tday && $month == $tmonth && $year == $tyear) {
		echo "<td><a id='day' href='javascript:void(0);' onclick='"; ?>
		javascript:getDayInformation(<?=$month;?>,<?=$year;?>,<?=$day_num;?>)
		<?php echo "'><div class='calendartoday'>$day_num</div></a></td>";
		} else {
		echo "<td><a id='day' href='javascript:void(0);' onclick='"; ?>
		javascript:getDayInformation(<?=$month;?>,<?=$year;?>,<?=$day_num;?>)
		<?php echo "'><div class='calendardays'>$day_num</div></a></td>";
		}
		$day_num++;
		$day_count++;
		if ($day_count > 7)
		{
		echo "</tr><tr>";
		$day_count = 1;
		}
		}
		while ( $day_count >1 && $day_count <=7)
		{
		echo "<td> </td>";
		$day_count++;
		}
		?>
                        </tr>
                    </table></th>
                  </tr>
                  <tr>
                    <th colspan="7" align="center" class="calendarbg">Coded By Chris Cloyd</th>
                  </tr>
                  <tr>
                    <th colspan="7" align="center" class="calendarbgbottom">MYCalendar Version 1.0.0(Beta) </th>
                  </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
    </table>
    </td>
    <td><div id="month"></div></td>
  </tr>
</table>

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.