Hello, I'm new to this forum and I'm glad I found it.
I wrote this code for a PHP calendar as an assignment for college.
It works fine, but I also want today's day to show in another color and I can't find how to do that.
Can anyone help?
Below is the code...
Code: <html>
<head>
<div align="center"> <h1>Calendar</h1> </div>    
</head>
 
<body BGCOLOR="lightgreen">
 
<blockquote> 
<p> 
<div align="center">
<table border="1"> 
<?php
if (isset($_GET['next'])) 
{
$month = $_GET['month'] + 1 ;                                 
$year= $_GET['year'];
if($month > 12) 
{
$month = 1;
$year++ ;
}
$cur_date = mktime(0,0,0,$month,1,$year); 
}
elseif(isset($_GET['prev']))
{
      
$month = $_GET['month'] - 1;
$year= $_GET['year'];         
if($month < 1 )
{
$month = 12;
$year-- ;
}
$cur_date=mktime(0,0,0,$month,1,$year);
}
else               
{
$cur_date=mktime();
$year=date('Y',$cur_date);
$month=date('m',$cur_date);
$cur_date = mktime(0,0,0,$month,1,$year);
}
$month_name = date('F', $cur_date); 
$week_days = array(Mon,Tue,Wed,Thu,Fri,Sat,Sun); 
echo "<tr><td colspan="7">$month_name $year</td></tr>";
echo '<tr>'; 
foreach($week_days as $day) 
{
echo "<td>$day</td>";
}
echo '</tr>'; 
$num_of_days = date('t',$cur_date); 
$i = 1; 
$first_day = date('D', $cur_date); 
while ($i <= $num_of_days) 
{      
echo '<tr>'; 
foreach($week_days as $day) 
{ 
echo '<td>';          
if ( (($i == 1) && ($day != $first_day)) || $i > $num_of_days) 
$val = '';
else                            
$val = $i++;                   
echo "$val </td>"; 
}  
echo '</tr>'; 
}   
?>
</table>
</div> 
</blockquote> 
<div align="center">
<form name="nav_form" method="get" action = '<?php echo $_SERVER['PHP_SELF'];?>' > 
<input type="submit" name="prev" value="<<" > 
<input type="submit" name="next" value=">>" > 
<input type="hidden" name="month" value='<?php echo $month?>' >
<input type="hidden" name="year" value='<?php echo $year ?>' > 
</div> 
</form>
</body> 
</html>
The repetition structure: the while statement not working
New programming student, have assignment as follows:
PHP Mysql Staff Induction System
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right direction with this problem I have.I am trying to set up a system induct new members of staff onto their
problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according to the menu click as home, products etc. div is populating itz contents with html pages for these
Does design fit in FPGA ?
Hi all,I've made a large HCC-Design. Because of the program-size the compile process with the handel-c compiler takesvery long. Is there any possibility to find out whether the design fits into my
How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.I am working on a application which uses HTTP connection, but the problem here is that the response from server is late... I want to create
Pulling out some result data from MYSQL
Hey Guys, I've built a PHP page that has a for just imagine something like registration form, So obviously it posts data into my table in my DB, So Now what I’m trying to do is creating a form
Mail Form receiving emails with no content
Hi, I hope someone here can help me.I have a simple form in my website, it was working OK, after lots of trouble finding out how to make this form I managed to make it work.I had to create an
Perplexing problem showing a .jpg
Please disregard..........I figured it out
PHP and XML image gallery variable issue
I'm trying to display the large image on the same page as the thumbnails, to do that I'm passing a variable called $current. I know that the code to display large image works, because it works when no
Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.Some code runs as perfectly valid code, where i would like PHP to issue a warning / error.I guess this is because of the loose typing of PHP,