Good day,
Please have some time to look at my code:
<?
session_start();
function viewGroupShift1()
{
$value = $_SESSION['grpID'];
$alert="";
$Ids = split(",", $_SESSION['grpID']);
$count = count($Ids);
for($i=0; $i<=$count-1; $i++)
{
if($Ids[$i] <> "")
{
$Ids1[$x] = $Ids[$i];
$qry1 = "select distinct a.shift_id,
a.grpShiftName
from actatek_grpshiftmaster a,
actatek_shift b
where a.shift_id=b.shift_id
and a.grpShiftMasterID='".$Ids1[$x]."'";
$result1 = mysql_query($qry1);
list($value1,$value2) = mysql_fetch_array($result1);
if (isset($_GET['page1']))
{
$GLOBALS['page1'] = $_GET['page1'];
}
$limit1 = 5;
$qry = "select a.grpShiftMasterID,
a.grpShiftName,
CONCAT(c.fldlastName,', ',c.fldfirstName) as member
from actatek_grpshiftmaster a,
actatek_shift b,
actatek_usermaintenance c
where b.Shift_id=a.Shift_id
and a.fldUserID=c.fldUserID
and a.flag='0'
and a.Shift_id = '".$value1."' ";
$result = mysql_query($qry);
$number = mysql_num_rows($result);
$GLOBALS['total1'] = mysql_num_rows($result);
$GLOBALS['pager1'] = Pager1::getPagerData1($GLOBALS['total1'], $limit1, $GLOBALS['page1']);
$offset1 = $GLOBALS['pager1']->offset1;
$limit1 = $GLOBALS['pager1']->limit1;
$GLOBALS['page1'] = $GLOBALS['pager1']->page1;
if($GLOBALS['total1']>0){
$qryStr = $qry . " LIMIT $offset1, $limit1";
}else{
$qryStr = $qry;
}
?>
<html>
<head>
<title><?=$pageTitle;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/actatek.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#FFFFFF" leftmargin="5" topmargin="0" marginwidth="0" marginheight="0" onLoad="disable()">
<!--<form name="viewGroupShiftForm" id="viewGroupShiftForm" method="POST">-->
<table width="70%">
<tr>
<input type="hidden" name="shiftName" value="<? echo $name1;?>">
<td class="title" ><br><b><? echo $value2; ?> Members </td>
</tr>
</table>
<table>
<tr>
<td colspan="4"><?
if ($number>5)
{
if ($GLOBALS['page1'] == 1) // this is the first page - there is no previous page
echo "Previous";
else // not the first page, link to the previous page
echo "<a href=\"main.php?select=ShiftManager&getShift=GroupShift&view=1&page=" . ($GLOBALS['page1'] - 1) . "\"> Previous</a>";
for ($s = 1; $s <= $GLOBALS['pager1']->numPages1; $s++)
{
if ($s == $GLOBALS['pager1']->page1)
echo " $s";
}
echo ' of '.$GLOBALS['pager1']->numPages1;
if ($GLOBALS['page1'] == $GLOBALS['pager1']->numPages1) // this is the last page - there is no next page
echo " Next";
else // not the last page, link to the next page
echo " <a href=\"main.php?select=ShiftManager&getShift=GroupShift&view=1&page=" . ($GLOBALS['page1'] + 1) ."\">Next</a>";
}?>
</td>
</tr>
<tr>
<!--Column Header-->
<td colspan="3" class="columnHeader"><input type="checkbox" name="chk2" onClick="checkAll(this)"></td>
<td width="257" class="columnHeader">Members </td>
</tr>
<?
if ($number > 0)
{
for($k=0;$k<$number;$k++)
{
$var1 = $k%2;
if ($var1==1)
{
$color = "#FBB117";
}
else
{
$color = "#FFFFFF";
}
$shift_row = mysql_fetch_array($result);
$shift_id = $shift_row['grpShiftMasterID'];
$shift_desc = $shift_row['grpShiftName'];
$shift_member = $shift_row['member'];
echo sprintf("<tr><td colspan=\"%s\" bgcolor=\"%s\" align=\"%s\"><input type=\"%s\" name=\"%s\" value=\"%s\" /></td>
<td bgcolor=\"%s\" align=\"%s\">%s</td></tr>",
"3.95",$color, "center", "checkbox", "chk2", $shift_row['grpShiftMasterID'] ,
$color, "center",$shift_row['member']);
}
}
else
{ ?>
<tr>
<td colspan="3" align="center"></td>
<td align="left"><? echo "No Records Found.";?> </td>
</tr>
<? }?>
<tr>
<td><input type="button" name="DeleteBtn2A" class="btn" style="width:60px;" value="Delete" onClick="if(conf_empdelete()){deleteEmpGroupShift()}else{return false}"></input> </td>
</tr>
</table>
<table>
<tr> </tr>
<tr>
<th colspan="3" scope="row">Add Members:</th>
</tr>
<tr>
<th colspan="3" scope="row">
<select name="selectEmp">
<?
$Employees = "select fldUserID,
CONCAT(fldlastName,', ',fldfirstName)
from actatek_usermaintenance
where fldUserID not in
(select fldUserID from actatek_grpshiftmaster
where fldUserID is not null)
order by CONCAT(fldlastName,', ',fldfirstName) ";
$sqlresult = mysql_query($Employees);
echo "<option>"."--". "</option>";
while ($shiftdescription = mysql_fetch_array($sqlresult))
{
echo "<option value='".$shiftdescription[0]."'>".$shiftdescription[1]."</option>";
}?>
<input type="hidden" name="grpShiftID" value="<? echo $id1;?>">
</select>
</th>
</tr>
</table>
<p>
<input type="button" name="addBtnA" class="btn" style="width:60px;" value="Add" onclick="if(check()){add()}else{return false}"></input>
<input type="submit" name="addSftBtnA" class="btn" value="Cancel" onClick="document.displayGroupShiftForm.action='main.php?select=ShiftManager&getShift=GroupShift'">
</input>
</p>
<input type="hidden" name="grpShiftMasterID" value="">
<input type="hidden" name="shift_id" value="<? echo $value1;?>">
<input type="hidden" name="grpShiftName" value="<? echo $value2;?>">
<?
if (isset($_GET['delete1']) && $_GET['delete1']== 1)
{
$_SESSION['grpID']=$_POST['grpID'];
deleteEmpGroupShift1();
}
if (isset($_GET['edit']) && $_GET['edit']== 1)
{
editShift();
}
}
} return $alert;
}
if (isset($GET['view2']) && $GET['view2']==1)
{
if ($_POST['selectEmp'] == 0)
{
?><script>
alert("No member was selected.");
</script><?
}
else
{
$_SESSION['grpID'];
view();
//addEmpGrpShift();
}
}
?>
</body>
</form>
</html>
<?php
?>
Question:
1.) I always have an error saying document.displayGroupShiftFormm is null or not an object. What does it mean?
I hope someone can help me in this.... 😕