Jump to content

webdevandprog

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by webdevandprog

  1. Hi hello and thanks for the answer This is a simple calendar that have to remeber just one birthday (one variable) there is not need of a database. The problem that I have is when I add the variable (for example $birthday=12) it changes to another number in the next month (when it shouldn't appear).
  2. Hi Hello I have a problem with this code, I need to make a simple calendar with birthday reminder but it is not working. I just created two variables ($BirthdayMonth and $DayBirthday) but when I add the day, I need this variable ($DayBirthday) to be static, the problem is when I change to another month then the variable $DayBirthday would be changed. Here is the source code: <?php $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $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; } ?> <div id="calendar_div" name="calendar_div"> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; $BirthdayMonth = "February"; $DayBirthday = 12; for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "<tr>\n"; if(($i == $DayBirthday)) { echo "<td bgcolor='#0000FF' align='center' valign='middle' height='20px'>".($i - $startday + 1) ."</td>\n"; } elseif($i < $startday) { echo "<td></td>\n"; } else {echo "<td align='center' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>\n"; } if(($i % 7) == 6 ) echo "</tr>\n"; } echo "</br>"; echo "</br>"; echo $startday; echo $thismonth ?> </table> </td> </tr> </table> </div> Where Am I failing or where is the problem ?
×
×
  • 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.