compare time

Hi, i would like to compare current time and goaltime, but my code seems like it is cannot function..can you help me, what is wrong with my code? Below is my code.
Thank You :)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.style25 { color: #0000FF;
font-weight: bold;
.style30 {color: #000000}
.style31 {color: #FFFFFF}
.style32 {font-family: "Times New Roman", Times, serif}
.style34 {color: #66FF99}
function popup(mylink, windowname)
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink.href;, windowname, 'width=700,height=280,scrollbars=yes');
return false;


<form method="get">
<table width="554" height="135" border="1" align="center" bgcolor="">
<td bgcolor="" height="25" colspan="3"><div align="center" class="style25 style30 style32">STATUS</div></td>
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="time"; // Database name
$tbl_name="time1"; // Table name

mysql_connect($host,$username,$password) or die("Cannot connect to database server");
mysql_select_db($db_name)or die("cannot connect/select database");

$currenttime = date("h:i:s");

//$goaltime1 = $_POST["goaltime"];
//$goaltime = "05:01:00";

$result = mysql_query("SELECT * FROM time1");
echo "current time: $currenttime";

echo "<meta http-equiv= 'refresh' content='1'>";

while($row = mysql_fetch_array($result))

<tr bgcolor="#66FFFF" width="450" border="1" align="center" >
<td width="202" height="50"><span class="style34"><a href="data1.php?id=<?php echo $row['caseid'];?>" class="style30" onclick="return popup(this, 'notes')"></a></span><a href="data1.php?id=<?php echo $row['goaltime'];?>" class="style30" onclick="return popup(this, 'notes')"><?php echo $row['goaltime'];?></a></td>

<td width="98" valign="bottom" ><a href="data1.php?id=<?php echo $row['caseid'];?>" class="style30" onclick="return popup(this, 'notes')"><?php echo $row['caseid'];?></a></td>

<td width="232" valign="bottom" ><span class="style32">

$currenttime = date("h:i:s");
//$goaltime1 = $_GET['goaltime'];
$goaltime1 = '$goaltime';
if ($currenttime <= $goaltime1)

echo "<b>Have a nice time!</b>";
echo "<div align=center><img src=\"images/green.jpg\" alt=\"bla bla\" ></div>";
else if ($currenttime == $goaltime1)
echo "<b>Have a not really nice time!</b>";
echo "<div align=center><img src=\"images/yellow.jpg\" alt=\"bla bla\" ></div>";
echo "<div align=center><img src=\"images/red.jpg\" alt=\"bla bla\" ></div>";
echo "Goal has been reached!!!";

//stop loop

Please Login to post your reply or start a new topic