Issue loading content into DIV with Jquery
<p>I'm out of ideas and have been searching for awhile now, so hopefully someone can point me in the right direction.</p>

<p>I have a select box that allows a user to select a specific value. Then try to load a page using the URL/value and keep receiving a blank page.</p>

<p>Assuming no value is passed, it works. I've used this page in the same way quite a number of times in the past so I'm not certain whats wrong. Also, it only seems to fail if specific URL parameters are passed.  I remove a substantial amount of code outside of the problem area to make it a bit easier to read.</p>

<p>So 
$('#sheetDiv').load('loaddates.php');
will work
and 
$('#sheetDiv').load('loaddates.php?project_name=' + value);
will not</p>

<p><strong>Code for main page is below:</strong></p>

<pre><code>&lt;?php
session_start();
include('db.php');

if($_POST[submit]=="Submit")
{

mysql_query("INSERT INTO tblusers SET username='".$_POST[username]."',password='".$_POST[password]."',type='".$_POST[type]."'") or print mysql_error();
}
function make_star($x)
{
    $s="";
    for($i=1;$i&lt;=strlen($x);$i++)
    {
        $s.="*";
    }
    return $s;
}
?&gt;

&lt;head&gt;
&lt;script language="javascript" src="jscript/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="jscript/facefiles/jquery-1.2.2.pack.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="jscript/ddaccordion.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" language="javascript" src="jscript/jmenu.js"&gt;&lt;/script&gt;

&lt;script language="javascript" src="jscript/user.js"&gt;&lt;/script&gt;
&lt;script language="javascript" src="jscript/common.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="calendarDateInput.js"&gt;&lt;/script&gt;
&lt;script language="javascript"&gt;
function selectProject() {
    $('#selectProject').show();
    $('#addProject').hide();
}
function selectDate() {
    $('#addProject').hide();
    $('#selectDate').show();
    }
function pdelete(id)
{
    if(confirm('Are sure to delete the data ?')==true)
    {
    $.ajax({
                           type: "GET",
                           url: "ajax.php",
                           data: "act=delete&amp;tbl=timesheet"+"&amp;id="+id,
                           success: function(result){
                             $(".error").html(result);
                             setTimeout('window.location.reload()',2000);
                        }
    });
    }   


}
checked=false;
function checkedAll (myfrm) {
    var aa= document.getElementById('frm');
     if (checked == false)
          {
           checked = true
          }
        else
          {
          checked = false
          }
    for (var i =0; i &lt; aa.elements.length; i++) 
    {
     aa.elements[i].checked = checked;
    }
      }

function del() 
         {
               var flag=false;
                var pass ;
                 for(var i=0; i&lt;document.frm.length; i++) //check for all checkboxes
                 {
                   if( document.frm.elements[i].type=="checkbox" &amp;&amp; document.frm.elements[i].checked==true )
                   {
                        flag=true;

                   }
                 }
                    if(flag == true)
                    {
                      if(confirm("Do you sure to delete this?"))
                      {
                      return true;
                      }else
                      { return false;
                      }
                    }


                 if( flag==false )  // if no checkbox selected
                 {
                       alert("Please select at least one checkbox to proceed.");
                       return false;
                 }
        }

function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
  return false;
}
function loadUsers(id) {
if(id !=2) {
var value = $('#selectValue').val();
alert('loadates2.php?project_name=' + value);
$('#sheetDiv').load('loaddates.php?project_name=' + value);

}
else if(id == 2) {
var value = $('#f_new_age_date').val();
$('#sheetDiv').load('loaddates.php?project_date=' + value);
}
}

function addProject() {
$('#selectProject').hide();
$('#selectDate').hide();
$('#addProject').show();
}
&lt;/script&gt;
&lt;style&gt;
.selectday{
    border-right:#CBCBCB 1px solid;
    border-left:#CBCBCB 1px solid;
    border-bottom:#CBCBCB 1px solid;
    border-top:#CBCBCB 1px solid;
    color:#666;
    font-weight:bold;
    padding-left:5px;
    padding-right:5px;
    }
    .selectedday{
    border-right:#CBCBCB 1px solid;
    border-left:#CBCBCB 1px solid;
    border-bottom:#CBCBCB 1px solid;
    border-top:#CBCBCB 1px solid;
    color:#666;
    padding-left:15px;
    padding-right:15px;
    padding-top:7px;
    }
    .sday
    {
        color:#f69929;
        font-family:Arial;
        font-size:24px;
        font-weight:bold;
        }
&lt;/style&gt;
&lt;link href="css/menu.css" rel="stylesheet" type="text/css"&gt;

&lt;link rel="stylesheet" type="text/css" media="all" href="images/calendar.css" title="win2k-cold-1"&gt;
&lt;!-- main calendar program --&gt;
    &lt;script type="text/javascript" src="images/calendar.js"&gt;&lt;/script&gt;
    &lt;!-- language for the calendar --&gt;
    &lt;script type="text/javascript" src="images/calendar-en.js"&gt;&lt;/script&gt;
&lt;!-- the following script defines the Calendar.setup helper function, which makes
          adding a calendar a matter of 1 or 2 lines of code. --&gt;
    &lt;script type="text/javascript" src="images/calendar-setup.js"&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;div id="newContainer"&gt;

&lt;?php if($_SESSION[usertype] == "A" || $_SESSION[usertype] == "S" ) { ?&gt;
&lt;link href="css/style.css" rel="stylesheet" type="text/css" /&gt;
&lt;table width="100%" style="position:relative; left:15px;" border="0" cellspacing="0" cellpadding="0"&gt;
  &lt;?php include('header_project.php');?&gt;
 &lt;tr&gt;
    &lt;td  align="left" valign="top"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td align="center"&gt;&lt;div id="result" align="center" style="color:#FF0000; display:block;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td width="15%" height="395" align="left" valign="top" colspan="2"&gt;&lt;? include('menu.php')?&gt;&lt;/td&gt;
        &lt;td width="100%"  valign="top"&gt;
          &lt; &lt;div id="form_news"  style="width:850px; position:relative;left:52px;"&gt;

&lt;div id="options" style="margin-left: 350px;margin-top:130px;position:absolute;z-index:2"&gt;        
&lt;a href="#" onclick="addProject()"&gt;Add New&lt;/a&gt;   |  &lt;a href="#" onclick="selectProject()"&gt;Select Project &lt;/a&gt;
&lt;/div&gt;
&lt;div id="addProject" style="padding-top:15px; padding: 5px; display:none; height:500px; width:950px;position:relative; top:15px;"&gt;
&lt;table width="100%" style="position:relative; left:25px" border="0" align="left" cellpadding="0" cellspacing="0"&gt;

                 &lt;tr&gt;&lt;td colspan="8"&gt; 
                 &lt;form name="ff1" method="post" action="time.php"&gt;
                  &lt;table width="100%" border="0" align="left" cellpadding="5" cellspacing="3"&gt; 

                  &lt;tr align="left"&gt;
               &lt;tr&gt;

                    &lt;td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Project&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Work Code&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="90" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Employee Name&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="44" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt; Billable Hours&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="147" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Notes&lt;/span&gt;&lt;/td&gt;
                    &lt;td bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Date&lt;/span&gt;&lt;/td&gt;
                    &lt;td  &gt;&amp;nbsp;&lt;/td&gt;
               &lt;/tr&gt;
                  &lt;tr align="left"&gt;
                    &lt;td width="132" valign="top" class="f12b"&gt;&lt;select name="project_number" id="project_name"&gt;
                  &lt;option value=""&gt;Select&lt;/option&gt;
                  &lt;?php
                    $aa=mysql_query("select * from projects");
                    while($sql=mysql_fetch_array($aa))
                    {
                ?&gt;
                  &lt;option value="&lt;?php echo $sql['project_number']?&gt;" &gt;&lt;?php echo $sql['project_name']?&gt;&lt;/option&gt;
                  &lt;?php } ?&gt;
              &lt;/select&gt;&lt;/td&gt;
                    &lt;td width="127" valign="top" class="f12b"&gt;&lt;select name="task" id="task"&gt;
                  &lt;option value=""&gt;Select&lt;/option&gt;
                  &lt;?php
                    $aa=mysql_query("select * from work_codes");
                    while($sql=mysql_fetch_array($aa))
                    {
                ?&gt;
                  &lt;option value="&lt;?php echo $sql['work_codes']?&gt;"&gt;&lt;?php echo $sql['work_codes']?&gt;&lt;/option&gt;
                  &lt;?php } ?&gt;
                &lt;/select&gt; &lt;/td&gt;
                    &lt;td width="111" valign="top" class="login_fnt"&gt;&lt;select name="staff_name" id="staff_name"&gt;
                &lt;option value=""&gt;Select&lt;/option&gt;
                &lt;?php
                    $aa=mysql_query("select * from staff_members");
                    while($sql_clients=mysql_fetch_array($aa))
                    {
                ?&gt;
             &lt;option value="&lt;?php echo $sql_clients['staff_id']?&gt;" &gt;&lt;?php echo $sql_clients['staff_name']?&gt;&lt;/option&gt;
                &lt;?php } ?&gt;
          &lt;/select&gt;&lt;/td&gt;
                    &lt;td width="47" valign="top" class="f12b"&gt;&lt;input type="text" name="bill_hours" id="bill_hours" value="" size="5" /&gt;&lt;/td&gt;
                    &lt;td width="136" valign="top" class="f12b"&gt;&lt;textarea name="description" id="description" cols="20" rows="1"&gt;&lt;/textarea&gt;
                    &lt;input type="hidden" name="expense_date" value="&lt;?php echo $currdate;?&gt;" /&gt;                    &lt;/td&gt;
                    &lt;td width="185" valign="top" class="f12b"&gt;
                    &lt;?php
                    $currdate=date('Y-m-d');
                    ?&gt;
                    &lt;input name="new_age_date" id="f_new_age_date" onChange="document.form_news.new_rem_age_date.value=document.form_news.new_age_date.value" size="10" readonly="yes" type="text" value="&lt;?php echo $currdate;?&gt;"&gt; 
              &lt;img src="images/img.gif" id="trigger_new_age_date" style="cursor: pointer; border: medium none;" title="Select Date"&gt; 
              &lt;script type="text/javascript"&gt;
    Calendar.setup({
            inputField     :    "f_new_age_date",         
            ifFormat       :    "%Y-%m-%d",     
            button         :    "trigger_new_age_date",   
            singleClick    :    true                       
        });
          &lt;/script&gt;                    &lt;/td&gt;
                    &lt;td width="41" valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;tr align="left"&gt;
                    &lt;td valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="login_fnt"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr align="left"&gt;
                    &lt;td valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="login_fnt"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&lt;/td&gt;
                    &lt;td valign="top" class="f12b"&gt;&lt;input type="submit" name="submit" id="submit" value="Add Time" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/form&gt;
               &lt;/td&gt;&lt;/tr&gt;
            &lt;/table&gt;
&lt;/div&gt;

&lt;div id="selectProject" style="position:relative; z-index:1; padding-top:15px; padding: 5px; display:none; height:500px; width:950px; top:125px;"&gt;
&lt;div style="position:relative;bottom:45px"&gt;
&lt;p style="padding:5px padding-bottom:0px;margin-left:50px; "&gt; Select a Project:&lt;p&gt;
&lt;select id ="selectValue" style="margin-left:50px;position:relative;bottom:15px;width:150px;"&gt;
&lt;?php 
$aa1 = mysql_query("select * from projects");
while(@$sql=mysql_fetch_array($aa1)) {?&gt;
    &lt;option value="&lt;?php echo $sql[project_name]; ?&gt;"&gt;&lt;?php echo $sql[project_name]; ?&gt; &lt;/option&gt;
&lt;?php } ?&gt;
&lt;/select&gt;
&lt;input type="button" id="selectProjectSubmit" value="Submit" onclick="loadUsers()" style="position:relative;bottom:15px;"/&gt;


&lt;/div&gt;
&lt;div id="sheetDiv" style="height:500px;width:950px; border: solid 1px red; position:relative; bottom:70px;"&gt; random &lt;/div&gt;
&lt;/div&gt;

&lt;/td&gt;&lt;/tr&gt; 
                &lt;/table&gt;  
                &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;

    &lt;/table&gt;&lt;/td&gt;
  &lt;/tr&gt;


&lt;?php }?&gt;

&lt;/div&gt;





*****Code for loaded div below:*******






&lt;?php
session_start();
include('db.php');
?&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
function updateField(id, field, project_name, date) {
if(id) {
    $field = $('#'+id);
    $value = $field.val();
    $.ajax({
        type: "GET",
        url: "ajax2.php",
        data: "rqt=time&amp;idfield=" + id + "&amp;valuefield="+$value });
}
else {

        $.ajax({
        type: "GET",
        url: "ajax2.php",
        data: "rqt=updatetime&amp;valuefield="+ field + "&amp;date=" + date + "&amp;project_name=" + project_name});
}
}
function doit(id,fieldtype, newvalue) {
if(fieldtype=="staff_name" || fieldtype=="task"){
var newvalue = newvalue.options[newvalue.selectedIndex].value;
}


$.ajax({
                           type: "GET",
                           url: "ajax2.php",
                           data: "fieldtype=" + fieldtype + "&amp;id=" + id + "&amp;newvalue=" + newvalue,
                           });
}
&lt;/script&gt;
&lt;/head&gt;


&lt;?php if($_REQUEST[project_date]){
$currDate = date('Y-m-d', strtotime($_REQUEST[project_date]));
$dayOfWeek = date('N', strtotime($_REQUEST[project_date]));
if($dayOfWeek == 7) { $dayOfWeek = 0;}
$subtractTime = "-".(string)$dayOfWeek."days";
$newdate = strtotime($subtractTime , strtotime ($currDate) ) ;
$newdate = date ( 'Y-m-d' , $newdate );

$enddate = $newdate;
}
?&gt;
&lt;?php
if($_SESSION[usertype] == "E") { ?&gt;
&lt;table width="875px"  style="position:relative; left:15px;" border="0" align="left" cellpadding="0" cellspacing="0"&gt;


                   &lt;td colspan="8"&gt; 
                 &lt;table width="100%" border="0" align="left" cellpadding="5" cellspacing="3"&gt; 
               &lt;tr&gt;

                    &lt;td width="100" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Project Name&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Sunday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Monday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Tuesday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Wednesday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Thursday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Friday&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="100" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Saturday&lt;/span&gt;&lt;/td&gt;
               &lt;/tr&gt;
              &lt;?php  
               $totalhrs=0;
               $Query_dbl=mysql_query("select * from projects");
                while($dbl_=mysql_fetch_array($Query_dbl))
                            {
                            $counter = 0;
                            ?&gt;  &lt;?php
                            $secondCounter = 0;
                            $starting = true;
                            while($secondCounter != 7 ) {
                            $newdate = $enddate;
                            $newdate = strtotime("".$secondCounter."day" , strtotime($newdate));
                            $newdate = date("Y-m-d", $newdate);
                            $Query_fql=mysql_query("select * from timesheet where staff_name='".$_SESSION['staff_id']."' AND project_name='".$dbl_['project_name']."'");
                            if($secondCounter == 0 &amp;&amp; mysql_num_rows($Query_fql) &gt; 0 ) {
                            $PN_=mysql_fetch_array($Query_fql);
                            ?&gt;
                            &lt;tr&gt; &lt;td&gt; &lt;?php echo $PN_['project_name']; ?&gt; 
                            &lt;/td&gt;
                            &lt;?php $starting = false;}
                            $Query_sql=mysql_query("select * from timesheet where staff_name='".$_SESSION['staff_id']."' AND project_name='".$dbl_['project_name']."' AND expense_date='".$newdate."'");
                            $Query_xql=mysql_query("select * from timesheet where staff_name='".$_SESSION['staff_id']."' AND project_name='".$dbl_['project_name']."' AND expense_date='".$newdate."'");
                            $secondCounter++;
                            if(mysql_num_rows($Query_xql) &gt; 0) {
                            $currentDate = null;                            
                            while($sql_=mysql_fetch_array($Query_sql))
                            {
                                 if($currentDate != $sql_['expense_date']){
                                    $currentDate = $sql_['expense_date'];
                                    $cyell = mysql_query("SELECT SUM(bill_hours) AS newhours FROM timesheet WHERE expense_date='".$sql_['expense_date']."' and project_name='".$sql_['project_name']."' and staff_name='".$_SESSION['staff_id']."'");
                                    $cardyell=mysql_fetch_assoc($cyell);
                                    }
                                    else {
                                    continue;
                                    }
                  ?&gt;

                    &lt;td align="left"&gt; 
                    &lt;select style="width:100px" name="billHours" id="&lt;?php echo $sql_['id'] ?&gt;" onchange="updateField(this.id)"&gt;
                    &lt;?php $a = 0; while($a != 15) {?&gt;
                    &lt;option value="&lt;?php echo $a; ?&gt;" &lt;?php if($sql_['bill_hours'] == $a) { echo "selected"; } ?&gt;&gt; &lt;?php echo $a; ?&gt; &lt;/option&gt;
                    &lt;?php $a = $a + .5;} ?&gt;

                    &lt;/select&gt;
&lt;/td&gt;
                    &lt;?php $totalhrs += $sql_['bill_hours']; } } else{ if($starting == false) { ?&gt; &lt;td&gt;



                    &lt;select style="width:100px" name="billHours" id="" onchange="updateField(null, this.value, &lt;?php echo "'".$dbl_['project_name']."'";?&gt;, &lt;?php echo "'".$newdate."'";?&gt;)"&gt;
                    &lt;?php $a = 0; while($a != 15) {?&gt;
                    &lt;option value="&lt;?php echo $a; ?&gt;" &lt;?php if($sql_['bill_hours'] == $a) { echo "selected"; } ?&gt;&gt; &lt;?php echo $a; ?&gt; &lt;/option&gt;
                    &lt;?php $a = $a + .5;} ?&gt;

                    &lt;/select&gt;



                     &lt;/td&gt; &lt;?php }  } ?&gt; 
                  &lt;?php } ?&gt; &lt;/tr&gt; &lt;?php }
                  ?&gt;
                  &lt;tr&gt;
                    &lt;td align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td align="left" valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td colspan="2" align="right" valign="top" class="f12b"&gt;&lt;br/&gt;&lt;strong&gt;Total Hours&lt;/strong&gt;&lt;/td&gt;
                    &lt;td align="center" valign="top" class="f12b"&gt;
                      &lt;strong&gt;
                        &lt;?php
                    echo "&lt;br/&gt;";
                    echo $totalhrs;
                    ?&gt;
                      &lt;/strong&gt;&lt;/td&gt;
                    &lt;td align="left" valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td colspan="7" align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;/tr&gt;


                  &lt;/table&gt;
                &lt;/td&gt;&lt;/tr&gt; 
                &lt;/table&gt;

&lt;/div&gt;
&lt;?php } 
if($_SESSION[usertype] == "S" || $_SESSION[usertype] == "A"){ ?&gt;

&lt;table width="875px"  style="position:relative;left:15px; bottom:0px !important" border="0" align="left" cellpadding="0" cellspacing="0"&gt;


                   &lt;td colspan="8"&gt; 
                 &lt;table width="100%" border="0" align="left" cellpadding="5" cellspacing="3"&gt; 
               &lt;tr&gt;
                    &lt;td width="20" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="160" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Employee Name&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Date Worked&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"&gt;&lt;span class="text_pt space"&gt;Billable Hours&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="90" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Work Code&lt;/span&gt;&lt;/td&gt;
                    &lt;td width="44" bgcolor="#e1e1e1" &gt;&lt;span class="text_pt space"&gt;Notes&lt;/span&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;?php
                        $Query_sql=mysql_query("select * from timesheet where project_name='".$_REQUEST['project_name']."'");
                        $totalhrs=0;
                        while($sql_=mysql_fetch_array($Query_sql))
                        {

                  ?&gt;
                  &lt;tr&gt;
 &lt;td width="20" align="left" valign="top"&gt;
                    &lt;a  href="time.php?del=del&amp;id=&lt;?php echo $sql_['id']?&gt;" class="text_pt" style="position:relative; left:12px; title="Delete" onclick="return confirm('Are you sure you want to delete?')"&gt;&lt;img src="redx.png" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td width="90" align="left" valign="top" class="login_fnt"&gt;&lt;select onchange="doit(&lt;?php echo $sql_['id']?&gt;, 'staff_name', this)" name="staff_name" id="staff_name"&gt;
                &lt;option value=""&gt;Select&lt;/option&gt;
                &lt;?php
                    $aa=mysql_query("select * from staff_members");
                    while($sql_clients=mysql_fetch_array($aa))
                    {
                ?&gt;
             &lt;option value="&lt;?php echo $sql_clients['staff_id']?&gt;" &lt;?php if($sql_clients['staff_id']==$sql_['staff_name']) echo "selected";?&gt;&gt;&lt;?php echo $sql_clients['staff_name']?&gt;&lt;/option&gt;
                &lt;?php } ?&gt;
          &lt;/select&gt;&lt;/td&gt;

        &lt;td width="90" align="left" valign="top" class="login_fnt"&gt; &lt;input id="text" onblur="doit(&lt;?php echo $sql_['id']?&gt;, 'expense_date', this.value)" value="&lt;?php echo $sql_['expense_date'];?&gt;"/&gt;&lt;/td&gt; 



                    &lt;td width="44" align="left" valign="top" class="f12b"&gt;&lt;input type="text" onblur="doit(&lt;?php echo $sql_['id']?&gt;, 'bill_hours', this.value)" name="bill_hours" id="bill_hours" value="&lt;?php echo $sql_['bill_hours']?&gt;" size="5" /&gt;
                    &lt;?php
                    $totalhrs=$totalhrs+$sql_['bill_hours'];
                    ?&gt;                    
                    &lt;/td&gt;
 &lt;td width="86" align="left" valign="top" class="f12b"&gt;&lt;select name="task" id="task" onchange="doit(&lt;?php echo $sql_['id']?&gt;, 'task', this)"&gt;
                  &lt;option value=""&gt;Select&lt;/option&gt;
                  &lt;?php
                    $aa=mysql_query("select * from program_list");
                    while($sql=mysql_fetch_array($aa))
                    {
                ?&gt;
                  &lt;option value="&lt;?php echo $sql['id']?&gt;" &lt;?php if($sql['id']==$sql_['task']) echo "selected";?&gt;&gt;&lt;?php echo $sql['sports']?&gt;&lt;/option&gt;
                  &lt;?php } ?&gt;
                &lt;/select&gt; &lt;/td&gt;

                    &lt;td width="147" align="left" valign="top" class="f12b"&gt;&lt;textarea name="description" onblur="doit(&lt;?php echo $sql_['id']?&gt;, 'description', this.value)" style="height:20px" id="description" cols="20" rows="1"&gt;&lt;?php echo $sql_['description']?&gt;&lt;/textarea&gt;&lt;/td&gt;
                  &lt;/tr&gt;&lt;?php  $i++; }  
                  ?&gt;
                  &lt;tr&gt;
                    &lt;td align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td align="left" valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td colspan="2" align="right" valign="top" class="f12b"&gt;&lt;br/&gt;&lt;strong&gt;Total Hours&lt;/strong&gt;&lt;/td&gt;
                    &lt;td align="center" valign="top" class="f12b"&gt;
                      &lt;strong&gt;
                        &lt;?php
                    echo "&lt;br/&gt;";
                    echo $totalhrs;
                    ?&gt;
                      &lt;/strong&gt;&lt;/td&gt;
                    &lt;td align="left" valign="top" class="f12b"&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td colspan="7" align="left" valign="top"&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;/tr&gt;


                  &lt;/table&gt;
                &lt;/td&gt;&lt;/tr&gt; 
                &lt;/table&gt;
&lt;?php } ?&gt; 
</code></pre>
