I have a table with 7 columns(Complaintid id,name,school name etc...) and also have a button. When I click the button I need to pass the complaintid of that row to another page. The problem is that value is not passing in the ajax page.
<html>
<body>
?>
<form action="" name="frmcomplaint" id="frmcomplaint" method="post">
<table border="1" style="border-color: #FFFFFF;" >
<tr>
<th style="color: #FF0000">Sl. No</th>
<th style="color: #FF0000">Complaint Id</th>
<th style="color: #FF0000">Date</th>
<th style="color: #FF0000; width:200px;" >Name Of student</th>
<th style="color: #FF0000">District</th>
<th style="color: #FF0000">School Name</th>
<th style="color: #FF0000">Standard with </th>
<th style="color: #FF0000; width:200px;">Complaint</th>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
$date1=explode('-', $row[$i+2]);
$entrydate=$date1[2]."-".$date1[1]."-".$date1[0];
$job_id=$row[$i+1];
?>
<tr>
<td style="color: #000000"><?php echo $j;?></td>
<td style="color: #000000"><?php echo $row[complain_Id]; ?> </td>
<td style="color: #000000"><?php echo $entrydate;?></td>
<td style="color: #000000" ><?php echo $row[studname];?></td>
<td style="color: #000000"><?php echo $row[District];?></td>
<td style="color: #000000"><?php echo $row[School_name] ;?></td>
<td style="color: #000000"><?php echo $ row[Standard]."-".$row[Division];?></td>
<td id="disp" ><?php echo $row[Complaint];?></td>
<td id="button" name="viewbutton" >
<input type="button" value="View" class="button" id="'<?php $button; ?>'" onclick="selectedjob(alert('hi there')<?php $job_id ?>)">
</td>
</tr>
<?php
$button++;
$j=$j+1;
}
?>
<input type='hidden' value='view' class='button' name="selectedjob" id="selectedjob">
</table>
</form>
<script type="text/javascript">
function selectjob(jobid)
{
$('#selectedjob').val(jobid);
$('#frmSelectJob').attr('action', 'careers-apply.php');
$('#frmSelectJob').attr('method', 'post');
$('#frmSelectJob').submit();
}
</body>
</html>
Try this. You need to echo
<input type="button" value="View" class="button" id="'<?php echo $button; ?>'" onclick="selectedjob(<?php echo $job_id; ?>)">
EDIT
You can pass the jobid as like this
function selectjob(jobid)
{
window.location.href = "display.php?jobid=" + jobid;
}
get the job id in display.php as $_GET['jobid']
You can do it by using jquery. I write simple code for you. I try it. It should work
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" >
jQuery(document).ready(function(){
<?php
// $num_rows=mysql_num_rows(query result)
$num_rows=10;
for($i=1;$i<$num_rows+1;$i++)
{
?>
$("#button_<?=$i?>").click(function(){
//alert("hi");
var complain_Id = $("#complain_Id_<?=$i?>").val();
if($("#complain_Id_<?=$i?>").val()=='') complain_Id="";
var dataString = 'complain_Id='+ complain_Id;
$.ajax({
type: "POST",
url: "getresult.php",
data: dataString,
success: function(msg){
$('#count_display').html(msg);
}
}); //END $.ajax
});
<?php
}
?>
});
</script>
<html>
<body>
<?php
?>
<form action="" name="frmcomplaint" id="frmcomplaint" method="post">
<table border="1" style="border-color: #FFFFFF;" >
<tr>
<th style="color: #FF0000">Sl. No</th>
<th style="color: #FF0000">Complaint Id</th>
<th style="color: #FF0000">Date</th>
<th style="color: #FF0000; width:200px;" >Name Of student</th>
<th style="color: #FF0000">District</th>
<th style="color: #FF0000">School Name</th>
<th style="color: #FF0000">Standard with </th>
<th style="color: #FF0000; width:200px;">Complaint</th>
</tr>
<?php
$button=1;
//while($row=mysql_fetch_array($result))
for($i=1;$i<11;$i++)
{
/* $date1=explode('-', $row[$i+2]);
$entrydate=$date1[2]."-".$date1[1]."-".$date1[0];
$job_id=$row[$i+1];*/
?>
<tr>
<td style="color: #000000" ><?php echo $i;?></td>
<td style="color: #000000" id="comid"><?php echo $i; ?>
<input type="hidden" name="complain_Id_<?=$i?>" id="complain_Id_<?=$i?>" value="<?=$i?>"/> </td>
<td style="color: #000000"><?php echo $i+2;?></td>
<td style="color: #000000"><?php echo $i+3;?></td>
<td style="color: #000000"><?php echo $i+4;?></td>
<td style="color: #000000"><?php echo $i+5;?></td>
<td style="color: #000000"><?php echo $i+6;?></td>
<td id="disp" ><?php echo $i+7;?></td>
<td id="button" name="viewbutton" >
<input type="button" value="View" class="button_<?=$i?>" id="button_<?=$i?>" />
</td>
</tr>
<?php
//$button++;
//$j=$j+1;
}
?>
</table>
</form>
<div id="count_display" >
</div>
</body>
</html>
code for display.php
<?php
$complain_Id=$_POST['complain_Id'];
echo "complain_Id=".$complain_Id;
?>
Please change code as your need. I use a hidden input field to hold complain_Id value
Related
I am working on making modifications to a website. I have copied the code of an html file with table and inserted my php code to generate the table. I am having issue with the table rendering on the page on window resize. Attached are the links for how the table looks when window is resize.
On window resize, my columns are becoming rows.
Table when viewed in full browser
It's a dynamically generated table using php. Here's the code: Any help would be appreciated.
Thanks in advance.
<DIV class="section-container">
<DIV id="layout" class="rsp_kvheader">
<!-- custom_1 -->
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="table-layout: fixed;">
<tr>
<td>
<div align="left">
<TABLE style="background-color: #eee; background-image: url(http://eworksxl.web.com/repo/images/kv1.jpg);;;;;;;" width="100%" cellpadding="0" class="fullwidth" cellspacing="0" style="table-layout: fixed;">
<TBODY>
<TR>
<TD align="center"></TD>
</TR>
</TBODY>
</TABLE>
</div>
<br style="clear:both;">
<!-- ADD CUSTOM BLOCK -->
<div align="center" >
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout: auto;">
<tr>
<td align="center" valign="top" >
<div align="left">
<DIV><img width="2000" title="" assetid="122087963" src="../../image/timesheet_1.jpg" height="550" style="width:2000px;height:370px;" border="0" alt="" mce_src="/matrix/servlet/ShowAsset;jsessionid=4C8960FFB6D8F307F69627A62EC4099A?id=122087963&_dt=1488490190826" selectedfileurl="../../files/timesheet_1.jpg"></DIV>
</div>
</td>
</tr>
</table>
</div>
<br style="clear:both;">
<div align="center" >
<table border="0" cellpadding="0" cellspacing="0" width="80%" style="table-layout: auto;">
<tr>
<td align="center" valign="top" >
<div align="left">
<TABLE width="80%" cellpadding="0" cellspacing="0" style="table-layout: auto;">
<TBODY>
<TR>
<TD align="left">
<DIV class="rsp_content section Content-1Column-Text">
<H1><?php echo $fname." ".$lname ?></H1>
<div class="container">
<div class="table-responsive">
<table class="table table-striped table-bordered" style="table-layout: auto;" width="80%">
<thead>
<tr>
<th style="text-align:center" width="5%">#</th>
<th style="text-align:center" width="19%">Date</th>
<th style="text-align:center" width="19%">Day</th>
<th style="text-align:center" width="19%">Hours</th>
</tr>
</thead>
<tbody>
<form action ="timesheet.php" method="post">
<?php
$today = date("Y-m-d");
// echo $today;
$first_day = date("Y-m-1");
// echo $first_day;
$date = $first_day;
$i=0;
$table = $empid."_user";
while (strtotime($date) <= strtotime($today)) {
// echo "$date\n";
$newDate = date("m-d-Y", strtotime($date));
$day = date("l", strtotime($date));
$i++;
$sql_statement="select hours from $table where work_date='$newDate'";
$sql_result= $conn->query($sql_statement);
// $row=mysqli_fetch_row($sql_result);
// $hour_entered=$row[0];
// echo $hour_entered;
if(($sql_result->num_rows) > 0){
$row=mysqli_fetch_row($sql_result);
$hour_entered=$row[0];
}else{
$hour_entered=null;
}
?>
<tr>
<?php if($day=="Sunday" || $day=="Saturday"){
?>
<td style="color:orange; border: double 3px black;" align="center" width="5%">
<?php echo $i ?>
</td>
<td style="color:orange; border: double 3px black;" align="center" width="19%">
<?php echo $newDate ?>
<input type="hidden" name="dates[]" value="<?php echo $newDate?>">
</td>
<td style="color:orange; border: double 3px black;" align="center" width="19%">
<?php echo $day ?>
</td>
<?php
if($hour_entered!=null){
?>
<td align="center" style="color:orange; border: double 3px black;" width="19%">
<input type="text" name="hours[]" id="hour_input" value="<?php echo $hour_entered ?>" style="text-align:center" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
<!-- <?php echo $hour_entered ?> -->
</td>
<?php
}else{
?>
<td align="center" style="color:orange; border: double 3px black;" width="19%">
<input type="text" name="hours[]" style="text-align:center" value="0" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
<!-- <?php echo $hour_entered ?> -->
</td>
<?php
}
?>
</tr>
<?php
}else{
?>
<tr>
<td align="center" width="5%">
<?php echo $i ?>
</td>
<td align="center" width="19%">
<?php echo $newDate ?>
<input type="hidden" name="dates[]" value="<?php echo $newDate?>">
</td>
<td align="center" width="19%">
<?php echo $day ?>
<!-- <input type="hidden" name="dates[]" <?php echo $day?> > -->
</td>
<?php
if($hour_entered!=null){
?>
<td align="center" width="19%">
<input type="text" name="hours[]" id="hour_input" value="<?php echo $hour_entered ?>" style="text-align:center" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
<!-- <?php echo $hour_entered ?> -->
</td>
<?php
}else{
?>
<td align="center" width="19%">
<input type="text" name="hours[]" style="text-align:center" value="0" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
<!-- <?php echo $hour_entered ?> -->
</td>
<?php
}
?>
</tr>
<?php
}
?>
<?php
$date = date ("Y-m-d", strtotime("+1 day", strtotime($date)));
}
?>
<!-- </tr> -->
<tr>
<td colspan="4" align="right">
<input type="submit" value="Submit">
</td>
</tr>
</form>
</tbody>
</table>
</div>
</div>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</div>
</td>
</tr>
</table>
</div>
<br style="clear:both;">
<div align="center" >
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr>
<td align="center" valign="top" >
<div align="left">
<TABLE style="width: 100%; background-color: #414141;" cellpadding="0" cellspacing="0">
<TBODY>
<TR>
<TD style="text-align: center;">
<SPAN style="color: #ffffff; text-decoration: none;">
<SPAN style="color: #ffffff; text-decoration: none;">
<BR><BR>Share This Page:<BR>
<div id='webcom-component-socialmediashare-17657540220791720'></div>
</SPAN>
</SPAN>
</TD>
</TR>
</TBODY>
</TABLE>
</div>
</td>
</tr>
</table>
</div>
<br style="clear:both;">
</tr>
</table>
<!-- END-OF custom_1 -->
</DIV>
</DIV>
I am getting this error message when run the code below. Below is the code that is giving me error messages. This is the error message
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\jq\fines\admin\portal.php on line 218
My code:
<body class="easyui-layout">
<div region="north" class="title" border="false" style="height:40px;">
Client Services Admin Portal
</div>
<div region="center" border="false">
<div id="pp" style="position:relative">
<div style="width:30%;">
<div title="Time" style="text-align:center;background:#f3eeaf;height:170px;padding:5px;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100" height="100">
<param name="movie" value="http://www.respectsoft.com/onlineclock/analog.swf">
<param name=quality value=high>
<param name="wmode" value="transparent">
<embed src="http://www.respectsoft.com/onlineclock/analog.swf" width="100" height="100" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</div>
<div title="Current Users Logged On" collapsible="true" closable="false" style="height:250px;padding:3px;">
<center>
<?php require_once "fines/admin/usersloggedon.php"; ?>
</center>
</div>
</div>
<div style="width:70%;">
<div title="Search for receipt" closable="false" style="height:170px;padding:10px;">
<center>
<form action="" method="post" id="receiptnumSearch">
<input type="hidden" name="check" value="submitted">
<input class="easyui-searchbox" style="width:200px" name="receiptnum" data-options="prompt:'',searcher:doReceiptSearch">
</form>
<br/>
<div style="background-color:#3FF; height:1px"> </div><br/>
<?php
require_once"functions.php";
if($_POST['check']=='submitted')//open1
{
//checking for errors
$receiptnum=trim($_POST['receiptnum']);
if($receiptnum=='')//open
{
//System error
echo SysError('Search field empty', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}//closed
elseif(!empty($receiptnum))//open
{
?><table class='tablestyle2' width=95% cellpadding=2 cellspacing=0>
<tr valign=top>
<td ><table width="100%" border="0" cellspacing="0" cellpadding="0" class='tablestyle_inner'>
<tr>
<td width="40%" class='tableheader' height="25">Paid From Library</td>
<td width="30%" class='tableheader'>Patron Name</td><td width="30%" class='tableheader'>Receipt Number</td>
</tr>
<?php
$db1w = new PDO('mysql:host=10.40.254.229;dbname=koha_msulibrary;charset=utf8', 'root', 'philly');
$gt_r=$db1w->query("SELECT * FROM fine, borrowers,branch_libs where borrowers.cardnumber=fine.cardnumber AND branch_libs.brunchid=fine.brunchid AND fine.receiptNum='$receiptnum' LIMIT 0,1");
$gt_r_results=$gt_r->fetch(PDO::FETCH_ASSOC);
echo'
<tr>
<td class=\'label\' height="25" align="center">'.$gt_r_results['branch_name'].'</td>
<td class=\'label\' align="center">'.ucwords(strtolower($gt_r_results['firstname'].' '.$gt_r_results['surname'])).'</td>
<td class=\'label\' align="center"><a target="_blank" href="http://www.msu.ac.zw/libraries/jq/fines/receipt.php?invoice='.base64_encode('invoce_view').'&t='.base64_encode($gt_r_results['receiptNum']).'">'.$gt_r_results['receiptNum'].'</a></td>
</tr>';
?>
</table></td></tr></table>
<?
}//closed
}//closed
?>
</center>
</div>
<div title="Library Fines Statistics" closable="false" style="height:250px;text-align:center;">
<center>
<br/><form action="" id="date_range" method="post"><table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><input type="hidden" name="date_r" value="date_r"><input name="data1" class="easyui-datebox" value="Start Date" width="200px"></input></td>
<td width="37%"><input name="data2" class="easyui-datebox" value="End Date" width="200px"></input></td>
<td width="24%">View Fines</td>
</tr>
</table></form>
<br/>
<?php
$data1=$_POST['data1'];
$data2=$_POST['data2'];
$date_r=$_POST['date_r'];
$dat=date('Y-m-d');
$da_1=strtotime($data1);
$data_=date('Y-m-d',$da_1);
//$da_2=strtotime($data2_);
//$data2=date('Y-m-d',$da_2);
//checking if date is real date
if((!isRealDate($data1) or !isRealDate($data2) or $dat < $data_ ) and $date_r=='date_r')
{
echo SysError('Incorrect date range', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}
//end of check
else{
?>
<table width=95% height="125" cellpadding=2 cellspacing=0 class='tablestyle2'>
<tr valign=top><td ><table width="100%" height="122" border="0" cellpadding="0" cellspacing="0" class='tablestyle_inner'> <tr> <td width="50%" class='tableheader' height="19">Branch Library</td> <td width="50%" class='tableheader'>
<?php
if($date_r=='date_r')
{
echo 'Fine collected between '.$data1.' and '.$data2;
}
else
{
echo 'Fines Collected to Date';
}
?></td>
</tr>
<tr>
<td class='label' height="12" >Batanai Library</td>
<td class='label' style="padding-left:10px">
<?php //checking if the date is real
if($date_r!='date_r')
{
echo GETbranchlibs('2');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'2');
}
?></td>
</tr>
<tr>
<td class='label' height="6">GSBL</td>
<td class='label' style="padding-left:10px">
<?php
if($date_r!='date_r')
{
echo GETbranchlibs('3');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'3');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Law Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('4');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'4');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Main Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('1');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,1);
}
?></td>
</tr>
<tr>
<td class='label' height="2" >Total</td>
<td class='label' style="padding-left:10px; font-weight:bold;"><u><?php
if($date_r!='date_r')
{
echo GETbranchlibs('0');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'0');
}
}
?></u></td>
</tr>
</table></td></tr></table></center>
</div>
</div>
</div>
</div>
You wrote somewhere in there
<? instead of <?php
So just change that and it will work. Tested on http://www.compileonline.com/execute_php_online.php
I am having a table with 7 columns(Complaintid id,name,school name etc...) and also have button. When I click the button I need to pass the complaintid of that row to another page. pls help me find a way to pass the value.
<html>
<body>
<?php
include '../library/dbconnect.php';
$query="SELECT * FROM Complaint_register WHERE status=1 ORDER BY entrydate ";
$result=mysql_query($query) or die("Selection query of
Complaint_register is Error ".mysql_error());
$num = mysql_numrows($result);
$i=0;
$j=1;
?>
<form action="" name="frmcomplaint" id="frmcomplaint" method="post">
<table border="1" style="border-color: #FFFFFF;" >
<tr>
<th style="color: #FF0000">Sl. No</th>
<th style="color: #FF0000">Complaint Id</th>
<th style="color: #FF0000">Date</th>
<th style="color: #FF0000; width:200px;" >Name Of student</th>
<th style="color: #FF0000">District</th>
<th style="color: #FF0000">School Name</th>
<th style="color: #FF0000">Standard with </th>
<th style="color: #FF0000; width:200px;">Complaint</th>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
$date1=explode('-', $row[$i+2]);
$entrydate=$date1[2]."-".$date1[1]."-".$date1[0];
$job_id=$row[$i+1];
?>
<tr>
<td style="color: #000000"><?php echo $j;?></td>
<td style="color: #000000"><?php echo $row[complain_Id]; ?> </td>
<td style="color: #000000"><?php echo $entrydate;?></td>
<td style="color: #000000" ><?php echo $row[studname];?></td>
<td style="color: #000000"><?php echo $row[District];?></td>
<td style="color: #000000"><?php echo $row[School_name] ;?></td>
<td style="color: #000000"><?php
echo $row[Standard]."-".$row[Division];?></td>
<td id="disp" ><?php echo $row[Complaint];?></td>
<td id="button" name="viewbutton" >
</td>
</tr>
<?php
$button++;
$j=$j+1;
}
?>
</table>
</form>
</body>
</html>
Instead of using
<td id="button" name="viewbutton" >
</td>
use,
<td>
<input type="button" onclick="functionname(<?php echo $row[complain_Id]; ?>)">
</td>
and add a javascript function
<script>
function functioname(param)
{
window.location="redirectionpage?id="+param;
}
</script>
This will redirect to the page redirectionpage with the id.
Few Loop holes in your current attempt.
Strictly use mysqli or PDO instead of mysql as it's been deprecated.
It's mysql_num_rows not mysql_numrows.
Now coming to your problem, you can solve this by using jQuery ajax.
$("table").on("click","#button",function(){
var cid = $("#disp").text();
$.ajax({
type: "GET",
url: "anotherpage.php",
data: { complainid: cid},
success: function(data) {
alert(data) //To check if response is success
}
});
});
anotherpage.php:
<?php
$cid = $_GET['complainid'];
?>
You can use a link with complain id like complaints.php?complainid=echo your value here
<td id="button" name="viewbutton" >
view complaint
</td>
and you can style that link like a button if needed.
In complaints.php page you can take the details of that complain with the id you passed.
Here is my php code
<?php
include "conn.php";
if(isset($_POST['submit'])){
$id_guru=htmlentities($_POST['id_guru']);
$id_pelajaran=htmlentities($_POST['id_pelajaran']);
$id_kelas=htmlentities($_POST['id_kelas']);
$query=mysql_query("insert into tbl_jadwal values('','$id_guru','$id_pelajaran','$id_kelas')");
if($query){
?><script language="javascript">document.location.href="?page=jadwal_pengajaran&status=1";</script><?php
}else{
?><script language="javascript">document.location.href="?page=jadwal_pengajaran&status=2";</script><?php
}
}else{
unset($_POST['submit']);
}
?>
<!-- start page-heading --><title>Sistem Informasi SMP YPPI</title>
<div id="page-heading">
<h1>Jadwal Pengajaran</h1>
</div>
<!-- end page-heading -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td>
<!-- start content-table-inner ...................................................................... START -->
<div id="content-table-inner">
<?php
if($_GET['status']=='1'){
?>
<div id="message-green">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="green-left">Data Tersimpan</td>
<td class="green-right"><a class="close-green"><img src="images/table/icon_close_green.gif" alt="" /></a></td>
</tr>
</table>
</div>
<?php
}
if($_GET['status']=='0'){
?>
<div id="message-red">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="red-left">Gagal Menyimpan</td>
<td class="red-right"><a class="close-red"><img src="images/table/icon_close_red.gif" alt="" /></a></td>
</tr>
</table>
</div>
<?php
}
?>
<form action="?page=jadwal_pengajaran" method="post">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><!-- start step-holder -->
<!-- end step-holder -->
<!-- start id-form -->
<table border="0" cellpadding="0" cellspacing="0" id="id-form">
<tr>
<th valign="top">Guru</th>
<td><select name="id_guru" class="styledselect_form_1">
<?php
$guru=mysql_query("select * from data_guru order by nama_guru asc");
while($row1=mysql_fetch_array($guru)){
?>
<option value="<?php echo $row1['id_guru'];?>"><?php echo $row1['nama_guru'];?> [ <?php echo $row1['nip'];?> ] <option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th valign="top">Pelajaran</th>
<td><select name="id_pelajaran" class="styledselect_form_1">
<?php
$pelajaran=mysql_query("select * from setup_pelajaran order by nama_pelajaran asc");
while($row2=mysql_fetch_array($pelajaran)){
?>
<option value="<?php echo $row2['id_pelajaran'];?>"><?php echo $row2['nama_pelajaran'];?></option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th valign="top">Kelas</th>
<td><select name="id_kelas" class="styledselect_form_1">
<?php
$kelas=mysql_query("select * from setup_kelas order by nama_kelas asc");
while($row3=mysql_fetch_array($kelas)){
?>
<option value="<?php echo $row3['id_kelas'];?>"><?php echo $row3['nama_kelas'];?></option>
<?php
}
?>
</select>
</td>
<td></td>
</tr>
<tr>
<th> </th>
<td valign="top"><input type="submit" name="submit" class="form-submit" />
<input type="reset" class="form-reset" />
</td>
<td></td>
</tr>
</table>
<!-- end id-form -->
</td>
<td><!-- start related-activities -->
</td>
</tr>
<tr>
<td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
<td></td>
</tr>
</table>
</form>
<p><em>*Tidak boleh 1 Kelas, 1 Pelajaran di ajarkan oleh 2 Guru atau lebih<br /></em> </p>
<p> </p>
<!-- start product-table ..................................................................................... -->
<form id="mainform" action="">
<table border="0" width="71%" cellpadding="0" cellspacing="0" id="product-table">
<tr>
<th width="13%" class="table-header-repeat line-left minwidth-1">Nomor </th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Nama Guru</th>
<th width="26%" class="table-header-repeat line-left minwidth-1">NIP</th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Mata Pelajaran</th>
<th width="24%" class="table-header-repeat line-left minwidth-1">Kelas</th>
<th width="13%" class="table-header-options line-left">Aksi</th>
</tr>
**<?php
$view=mysql_query("*SELECT* FROM tbl_jadwal jadwal, setup_kelas kelas, setup_pelajaran pelajaran, data_guru guru where jadwal.id_kelas=kelas.id_kelas and jadwal.id_pelajaran=pelajaran.id_pelajaran and jadwal.id_guru=guru.id_guru order by id_jadwal asc");
$no=0;
while($row=mysql_fetch_array($view)){
?>
<tr>
<td><?php echo $no=$no+1;?></td>
<td><?php echo $row['nama_guru'];?></td>
<td><?php echo $row['nip'];?></td>
<td><?php echo $row['nama_pelajaran'];?></td>
<td><?php echo $row['nama_kelas'];?></td>
<td class="options-width">
</td>
</tr>
<?php
}
?>
</table>
<!-- end product-table................................... -->
</form>
<div class="clear"></div>
</div>
<!-- end content-table-inner ............................................END -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
<th class="sized bottomleft"></th>
<td id="tbl-border-bottom"> </td>
<th class="sized bottomright"></th>
</tr>
</table>**
When i test the code on browser, there's nothing displayed, only empty table, but there is saved data on the database.
I believe the problem came from
**<?php
$view=mysql_query("*SELECT* FROM tbl_jadwal jadwal, setup_kelas kelas, setup_pelajaran pelajaran, data_guru guru where jadwal.id_kelas=kelas.id_kelas and jadwal.id_pelajaran=pelajaran.id_pelajaran and jadwal.id_guru=guru.id_guru order by id_jadwal asc");
$no=0;
while($row=mysql_fetch_array($view)){
?>
<tr>
<td><?php echo $no=$no+1;?></td>
<td><?php echo $row['nama_guru'];?></td>
<td><?php echo $row['nip'];?></td>
<td><?php echo $row['nama_pelajaran'];?></td>
<td><?php echo $row['nama_kelas'];?></td>
<td class="options-width">
</td>
</tr>
<?php
}
?>
But still I can't figure out what the problem is.
is that
$view=mysql_query("*SELECT* FROM ...
from the paste, it should look like this:
$view=mysql_query("SELECT * FROM ...
and
while($row=mysql_fetch_array($view)){
will give you a numbered array, not an associative array. Thus you need to EITHER access fields in their order:
<td><?php echo $row[0];?></td>
<td><?php echo $row[1];?></td> ...
or use assoc (NOT BOTH):
while($row=mysql_fetch_assoc($view)){
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm out of ideas and have been searching for awhile now, so hopefully someone can point me in the right direction.
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.
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.
So
$('#sheetDiv').load('loaddates.php');
will work
and
$('#sheetDiv').load('loaddates.php?project_name=' + value);
will not
Code for main page is below:
<?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<=strlen($x);$i++)
{
$s.="*";
}
return $s;
}
?>
<head>
<script language="javascript" src="jscript/jquery.js"></script>
<script type="text/javascript" src="jscript/facefiles/jquery-1.2.2.pack.js"></script>
<script type="text/javascript" src="jscript/ddaccordion.js"></script>
<script type="text/javascript" language="javascript" src="jscript/jmenu.js"></script>
<script language="javascript" src="jscript/user.js"></script>
<script language="javascript" src="jscript/common.js"></script>
<script type="text/javascript" src="calendarDateInput.js"></script>
<script language="javascript">
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&tbl=timesheet"+"&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 < aa.elements.length; i++)
{
aa.elements[i].checked = checked;
}
}
function del()
{
var flag=false;
var pass ;
for(var i=0; i<document.frm.length; i++) //check for all checkboxes
{
if( document.frm.elements[i].type=="checkbox" && 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();
}
</script>
<style>
.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;
}
</style>
<link href="css/menu.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" media="all" href="images/calendar.css" title="win2k-cold-1">
<!-- main calendar program -->
<script type="text/javascript" src="images/calendar.js"></script>
<!-- language for the calendar -->
<script type="text/javascript" src="images/calendar-en.js"></script>
<!-- the following script defines the Calendar.setup helper function, which makes
adding a calendar a matter of 1 or 2 lines of code. -->
<script type="text/javascript" src="images/calendar-setup.js"></script>
</head>
<div id="newContainer">
<?php if($_SESSION[usertype] == "A" || $_SESSION[usertype] == "S" ) { ?>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<table width="100%" style="position:relative; left:15px;" border="0" cellspacing="0" cellpadding="0">
<?php include('header_project.php');?>
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td align="center"><div id="result" align="center" style="color:#FF0000; display:block;"> </div></td>
</tr>
<tr>
<td width="15%" height="395" align="left" valign="top" colspan="2"><? include('menu.php')?></td>
<td width="100%" valign="top">
< <div id="form_news" style="width:850px; position:relative;left:52px;">
<div id="options" style="margin-left: 350px;margin-top:130px;position:absolute;z-index:2">
Add New | Select Project
</div>
<div id="addProject" style="padding-top:15px; padding: 5px; display:none; height:500px; width:950px;position:relative; top:15px;">
<table width="100%" style="position:relative; left:25px" border="0" align="left" cellpadding="0" cellspacing="0">
<tr><td colspan="8">
<form name="ff1" method="post" action="time.php">
<table width="100%" border="0" align="left" cellpadding="5" cellspacing="3">
<tr align="left">
<tr>
<td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Project</span></td>
<td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Work Code</span></td>
<td width="90" bgcolor="#e1e1e1" ><span class="text_pt space">Employee Name</span></td>
<td width="44" bgcolor="#e1e1e1" ><span class="text_pt space"> Billable Hours</span></td>
<td width="147" bgcolor="#e1e1e1" ><span class="text_pt space">Notes</span></td>
<td bgcolor="#e1e1e1" ><span class="text_pt space">Date</span></td>
<td > </td>
</tr>
<tr align="left">
<td width="132" valign="top" class="f12b"><select name="project_number" id="project_name">
<option value="">Select</option>
<?php
$aa=mysql_query("select * from projects");
while($sql=mysql_fetch_array($aa))
{
?>
<option value="<?php echo $sql['project_number']?>" ><?php echo $sql['project_name']?></option>
<?php } ?>
</select></td>
<td width="127" valign="top" class="f12b"><select name="task" id="task">
<option value="">Select</option>
<?php
$aa=mysql_query("select * from work_codes");
while($sql=mysql_fetch_array($aa))
{
?>
<option value="<?php echo $sql['work_codes']?>"><?php echo $sql['work_codes']?></option>
<?php } ?>
</select> </td>
<td width="111" valign="top" class="login_fnt"><select name="staff_name" id="staff_name">
<option value="">Select</option>
<?php
$aa=mysql_query("select * from staff_members");
while($sql_clients=mysql_fetch_array($aa))
{
?>
<option value="<?php echo $sql_clients['staff_id']?>" ><?php echo $sql_clients['staff_name']?></option>
<?php } ?>
</select></td>
<td width="47" valign="top" class="f12b"><input type="text" name="bill_hours" id="bill_hours" value="" size="5" /></td>
<td width="136" valign="top" class="f12b"><textarea name="description" id="description" cols="20" rows="1"></textarea>
<input type="hidden" name="expense_date" value="<?php echo $currdate;?>" /> </td>
<td width="185" valign="top" class="f12b">
<?php
$currdate=date('Y-m-d');
?>
<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="<?php echo $currdate;?>">
<img src="images/img.gif" id="trigger_new_age_date" style="cursor: pointer; border: medium none;" title="Select Date">
<script type="text/javascript">
Calendar.setup({
inputField : "f_new_age_date",
ifFormat : "%Y-%m-%d",
button : "trigger_new_age_date",
singleClick : true
});
</script> </td>
<td width="41" valign="top" class="f12b"> </td>
</tr>
<tr align="left">
<td valign="top"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="login_fnt"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="f12b"> </td>
</tr>
<tr align="left">
<td valign="top"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="login_fnt"> </td>
<td valign="top" class="f12b"> </td>
<td valign="top" class="f12b"></td>
<td valign="top" class="f12b"><input type="submit" name="submit" id="submit" value="Add Time" /></td>
</tr>
</table>
</form>
</td></tr>
</table>
</div>
<div id="selectProject" style="position:relative; z-index:1; padding-top:15px; padding: 5px; display:none; height:500px; width:950px; top:125px;">
<div style="position:relative;bottom:45px">
<p style="padding:5px padding-bottom:0px;margin-left:50px; "> Select a Project:<p>
<select id ="selectValue" style="margin-left:50px;position:relative;bottom:15px;width:150px;">
<?php
$aa1 = mysql_query("select * from projects");
while(#$sql=mysql_fetch_array($aa1)) {?>
<option value="<?php echo $sql[project_name]; ?>"><?php echo $sql[project_name]; ?> </option>
<?php } ?>
</select>
<input type="button" id="selectProjectSubmit" value="Submit" onclick="loadUsers()" style="position:relative;bottom:15px;"/>
</div>
<div id="sheetDiv" style="height:500px;width:950px; border: solid 1px red; position:relative; bottom:70px;"> random </div>
</div>
</td></tr>
</table>
</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table></td>
</tr>
<?php }?>
</div>
*****Code for loaded div below:*******
<?php
session_start();
include('db.php');
?>
<head>
<script type="text/javascript">
function updateField(id, field, project_name, date) {
if(id) {
$field = $('#'+id);
$value = $field.val();
$.ajax({
type: "GET",
url: "ajax2.php",
data: "rqt=time&idfield=" + id + "&valuefield="+$value });
}
else {
$.ajax({
type: "GET",
url: "ajax2.php",
data: "rqt=updatetime&valuefield="+ field + "&date=" + date + "&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 + "&id=" + id + "&newvalue=" + newvalue,
});
}
</script>
</head>
<?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;
}
?>
<?php
if($_SESSION[usertype] == "E") { ?>
<table width="875px" style="position:relative; left:15px;" border="0" align="left" cellpadding="0" cellspacing="0">
<td colspan="8">
<table width="100%" border="0" align="left" cellpadding="5" cellspacing="3">
<tr>
<td width="100" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Project Name</span></td>
<td width="100" bgcolor="#e1e1e1" ><span class="text_pt space">Sunday</span></td>
<td width="100" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Monday</span></td>
<td width="100" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Tuesday</span></td>
<td width="100" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Wednesday</span></td>
<td width="100" bgcolor="#e1e1e1" ><span class="text_pt space">Thursday</span></td>
<td width="100" bgcolor="#e1e1e1" ><span class="text_pt space">Friday</span></td>
<td width="100" bgcolor="#e1e1e1" ><span class="text_pt space">Saturday</span></td>
</tr>
<?php
$totalhrs=0;
$Query_dbl=mysql_query("select * from projects");
while($dbl_=mysql_fetch_array($Query_dbl))
{
$counter = 0;
?> <?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 && mysql_num_rows($Query_fql) > 0 ) {
$PN_=mysql_fetch_array($Query_fql);
?>
<tr> <td> <?php echo $PN_['project_name']; ?>
</td>
<?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) > 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;
}
?>
<td align="left">
<select style="width:100px" name="billHours" id="<?php echo $sql_['id'] ?>" onchange="updateField(this.id)">
<?php $a = 0; while($a != 15) {?>
<option value="<?php echo $a; ?>" <?php if($sql_['bill_hours'] == $a) { echo "selected"; } ?>> <?php echo $a; ?> </option>
<?php $a = $a + .5;} ?>
</select>
</td>
<?php $totalhrs += $sql_['bill_hours']; } } else{ if($starting == false) { ?> <td>
<select style="width:100px" name="billHours" id="" onchange="updateField(null, this.value, <?php echo "'".$dbl_['project_name']."'";?>, <?php echo "'".$newdate."'";?>)">
<?php $a = 0; while($a != 15) {?>
<option value="<?php echo $a; ?>" <?php if($sql_['bill_hours'] == $a) { echo "selected"; } ?>> <?php echo $a; ?> </option>
<?php $a = $a + .5;} ?>
</select>
</td> <?php } } ?>
<?php } ?> </tr> <?php }
?>
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top"> </td>
<td align="left" valign="top" class="f12b"> </td>
<td colspan="2" align="right" valign="top" class="f12b"><br/><strong>Total Hours</strong></td>
<td align="center" valign="top" class="f12b">
<strong>
<?php
echo "<br/>";
echo $totalhrs;
?>
</strong></td>
<td align="left" valign="top" class="f12b"> </td>
</tr>
<tr>
<td colspan="7" align="left" valign="top"> </td>
</tr>
</table>
</td></tr>
</table>
</div>
<?php }
if($_SESSION[usertype] == "S" || $_SESSION[usertype] == "A"){ ?>
<table width="875px" style="position:relative;left:15px; bottom:0px !important" border="0" align="left" cellpadding="0" cellspacing="0">
<td colspan="8">
<table width="100%" border="0" align="left" cellpadding="5" cellspacing="3">
<tr>
<td width="20" class="login_fnt"><span class="text_pt space"> </span></td>
<td width="160" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Employee Name</span></td>
<td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Date Worked</span></td>
<td width="86" align="left" bgcolor="#e1e1e1" class="login_fnt"><span class="text_pt space">Billable Hours</span></td>
<td width="90" bgcolor="#e1e1e1" ><span class="text_pt space">Work Code</span></td>
<td width="44" bgcolor="#e1e1e1" ><span class="text_pt space">Notes</span></td>
</tr>
<?php
$Query_sql=mysql_query("select * from timesheet where project_name='".$_REQUEST['project_name']."'");
$totalhrs=0;
while($sql_=mysql_fetch_array($Query_sql))
{
?>
<tr>
<td width="20" align="left" valign="top">
<img src="redx.png" border="0" /></td>
<td width="90" align="left" valign="top" class="login_fnt"><select onchange="doit(<?php echo $sql_['id']?>, 'staff_name', this)" name="staff_name" id="staff_name">
<option value="">Select</option>
<?php
$aa=mysql_query("select * from staff_members");
while($sql_clients=mysql_fetch_array($aa))
{
?>
<option value="<?php echo $sql_clients['staff_id']?>" <?php if($sql_clients['staff_id']==$sql_['staff_name']) echo "selected";?>><?php echo $sql_clients['staff_name']?></option>
<?php } ?>
</select></td>
<td width="90" align="left" valign="top" class="login_fnt"> <input id="text" onblur="doit(<?php echo $sql_['id']?>, 'expense_date', this.value)" value="<?php echo $sql_['expense_date'];?>"/></td>
<td width="44" align="left" valign="top" class="f12b"><input type="text" onblur="doit(<?php echo $sql_['id']?>, 'bill_hours', this.value)" name="bill_hours" id="bill_hours" value="<?php echo $sql_['bill_hours']?>" size="5" />
<?php
$totalhrs=$totalhrs+$sql_['bill_hours'];
?>
</td>
<td width="86" align="left" valign="top" class="f12b"><select name="task" id="task" onchange="doit(<?php echo $sql_['id']?>, 'task', this)">
<option value="">Select</option>
<?php
$aa=mysql_query("select * from program_list");
while($sql=mysql_fetch_array($aa))
{
?>
<option value="<?php echo $sql['id']?>" <?php if($sql['id']==$sql_['task']) echo "selected";?>><?php echo $sql['sports']?></option>
<?php } ?>
</select> </td>
<td width="147" align="left" valign="top" class="f12b"><textarea name="description" onblur="doit(<?php echo $sql_['id']?>, 'description', this.value)" style="height:20px" id="description" cols="20" rows="1"><?php echo $sql_['description']?></textarea></td>
</tr><?php $i++; }
?>
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top"> </td>
<td align="left" valign="top" class="f12b"> </td>
<td colspan="2" align="right" valign="top" class="f12b"><br/><strong>Total Hours</strong></td>
<td align="center" valign="top" class="f12b">
<strong>
<?php
echo "<br/>";
echo $totalhrs;
?>
</strong></td>
<td align="left" valign="top" class="f12b"> </td>
</tr>
<tr>
<td colspan="7" align="left" valign="top"> </td>
</tr>
</table>
</td></tr>
</table>
<?php } ?>
You may want to use a different approach to send parameters:
$("#sheetDiv").load("loaddates.php", { "project_name": value } );
That should do the job!