Hi guys i really need some urgent help.
ok first problem is i have a calendar, that a user is able to enter data into, but when that data is finally displayed within the calendar, say for june/2005, i am also able to see the same data appear for june/2006/2007/2008/2009 etc etc, how do i fix this see attached code:
<?php
require_once("connection.php");
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
IF(!isset($_GET['year'])){
$_GET['year'] = date("Y");
}
IF(!isset($_GET['month'])){
$_GET['month'] = date("n")+1;
}
$month = $_GET['month']-1;
$query = "SELECT event_id, title, event_day, event_month, event_year, event_time FROM events WHERE event_month='$month' ORDER BY event_time \n" ;
$query_result = mysql_query ($query);
while ($info = mysql_fetch_array($query_result))
{
$day = $info['event_day'];
$event_id = $info['event_id'];
$events[$day][] = $info['event_id'];
$event_info[$event_id]['0'] = substr($info['title'],0, 25);
//To add the time value to the titles, addthe bottom code
$event_info[$event_id]['1'] = $info["event_time"];
}
$todays_date = date("j");
$todays_month = date("n");
$days_in_month = date ("t", mktime(0,0,0,$_GET['month'],0,$_GET['year']));
$first_day_of_month = date ("w", mktime(0,0,0,$_GET['month']-1,1,$_GET['year']));
$first_day_of_month = $first_day_of_month + 1;
$count_boxes = 0;
$days_so_far = 0;
IF($_GET['month'] == 13){
$next_month = 2;
$next_year = $_GET['year'] + 1;
} ELSE {
$next_month = $_GET['month'] + 1;
$next_year = $_GET['year'];
}
IF($_GET['month'] == 2){
$prev_month = 13;
$prev_year = $_GET['year'] - 1;
} ELSE {
$prev_month = $_GET['month'] - 1;
$prev_year = $_GET['year'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Events Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="cal.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function window(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=550,height =400");
}
function window2(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=550,height =300");
}
</script>
</head>
<body>
<div align="center"><span class="currentdate"><? echo date ("F Y", mktime(0,0,0,$_GET['month']-1,1,$_GET['year'])); ?></span><br>
<br>
</div>
<div align="center">
<table width="700" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#99CCCC">
<td colspan="4" valign="bottom"><img src="/work/images/spacer.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#99CCCC">
<td height="31" valign="bottom"><font color="#99CCCC">..</font>Today's Date is: <br />
<font color="#99CCCC">.</font><?php echo date ("<b> l dS of F Y </b>") ?></td>
<td colspan="2"> </td>
<td valign="middle"><a href="login.php">Admin Login </a></td>
</tr>
<tr bgcolor="#99CCCC">
<td><br />
<font color="#99CCCC">..</font>Time: <?php echo date("<b>h:i:s A</b>") ?><br />
</td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr bgcolor="#99CCCC">
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="4"> </td>
</tr>
<tr>
<td width="366" bgcolor="#F0F0F0"><div align="right"><font color="#F0F0F0"><a href="<? echo "index.php?month=$prev_month&year=$prev_year"; ?>"> << Previous Month << </a></font></div></td>
<td width="105" bgcolor="#F0F0F0">
<div align="center">
<font color="#F0F0F0">
<select name="month" class="addevent" id="month" onChange="MM_jumpMenu('parent',this,0)">
<?
for ($i = 1; $i <= 12; $i++) {
$link = $i+1;
IF($_GET['month'] == $link){
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option value=\"index.php?month=$link&year=$_GET[year]\" $selected>" . date ("F", mktime(0,0,0,$i,1,$_GET['year'])) . "</option>\n";
}
?>
</select>
</font></div></td>
<td width="105" bgcolor="#F0F0F0">
<div align="right">
<font color="#F0F0F0">
<select name="year" class="addevent" id="year" onChange="MM_jumpMenu('parent',this,0)">
<?
for ($i = 2000; $i <= 2010; $i++) {
IF($i == $_GET['year']){
$selected = "selected";
} ELSE {
$selected = "";
}
echo "<option value=\"index.php?month=$_GET[month]&year=$i\" $selected>$i</option>\n";
}
?>
</select>
</font></div></td>
<td width="363" bgcolor="#F0F0F0"><div align="left"><font color="#F0F0F0"><a href="<? echo "index.php?month=$next_month&year=$next_year"; ?>">>> Next Month >> </a></font></div></td>
</tr>
<tr>
<td bgcolor="#F0F0F0"> </td>
<td bgcolor="#F0F0F0"> </td>
<td bgcolor="#F0F0F0"> </td>
<td bgcolor="#F0F0F0"> </td>
</tr>
</table>
</div>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td><table width="700" border="0" cellpadding="0" cellspacing="1">
<tr class="topdays">
<td><div align="center">Sunday</div></td>
<td><div align="center">Monday</div></td>
<td><div align="center">Tuesday</div></td>
<td><div align="center">Wednesday</div></td>
<td><div align="center">Thursday</div></td>
<td><div align="center">Friday</div></td>
<td><div align="center">Saturday</div></td>
</tr>
<tr valign="top" bgcolor="#FFFFFF">
<?
for ($i = 1; $i <= $first_day_of_month-1; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
echo "<td width=\"110\" height=\"110\" class=\"beforedayboxes\"></td>\n";
}
for ($i = 1; $i <= $days_in_month; $i++) {
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
IF($_GET['month'] == $todays_month+1){
IF($i == $todays_date){
$class = "highlighteddayboxes";
} ELSE {
$class = "dayboxes";
}
} ELSE {
IF($i == 1){
$class = "highlighteddayboxes";
} ELSE {
$class = "dayboxes";
}
}
echo "<td width=\"100\" height=\"100\" class=\"$class\">\n";
$link_month = $_GET['month'] - 1;
echo "<div align=\"right\"><span class=\"toprightnumber\">\n$i</a> </span></div>\n";
IF(isset($events[$i])){
echo "<div align=\"left\"><span class=\"eventinbox\">\n";
while (list($key, $value) = each ($events[$i])) {
echo "<a href=\"javascript:onClick=window('event.php?id=$value','','721','550','0','0','1','sc rollbars=yes')\">" . $event_info[$value]['1'] . " " . $event_info[$value]['0'] . "</a>\n<br>\n";
//echo " <a href=\"?id=$value\">" . $event_info[$value]['1'] . " " . $event_info[$value]['0'] . "</a>\n<br>\n";
}
echo "</span></div>\n";
}
echo "</td>\n";
IF(($count_boxes == 7) AND ($days_so_far != (($first_day_of_month-1) + $days_in_month))){
$count_boxes = 0;
echo "</TR><TR valign=\"top\">\n";
}
}
$extra_boxes = 7 - $count_boxes;
for ($i = 1; $i <= $extra_boxes; $i++) {
echo "<td width=\"100\" height=\"100\" class=\"afterdayboxes\"></td>\n";
}
$time_end = getmicrotime();
$time = round($time_end - $time_start, 3);
?>
</tr>
</table></td>
</tr>
</table>
<p align="center" class="footer">© 2005
Events Database</p>
</body>
</html>
2nd issue, i have to fields, one is called hour_to and minute_to, this is where the user enters the hour and minute (this is for "To" as in From | To), of course when i finally echo out this data, i get nothing except for 12:00 AM, and not the date entered, im using the same code as for the From fields aswell for the To fields, see code below: