Hi ,
I am new to php and am in serious need of help. I have been to develop and implement a php - mysql based Absentee System that can eventually be incorporated into Novell Portal system. Only problem is that I have never done php coding in my life .
The code will only work if the variables etc are hard coded in.
The Staff Page
<? require("../mytest/user.inc"); ?>
<? require("../mytest/database.inc"); ?>
<html>
<head>
<title>Sacred Heart College - Login to the system </title>
<link rel="stylesheet" type="text/css" href="../mytest/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #336699;
}
.style2 {color: #999999}
-->
</style></head>
<body>
<table width="100%"
border="0" cellpadding="0" cellspacing="0" class="heading">
<tr><td height="119">
<center>
<table><tr><td><img src="../mytest/shcslogo.gif"
alt="logo"></td><td width="20"></td><td align="center" valign="center">
<br>
<span class="headingtext">Sacred Heart College<br>
Teacher Administration</span>
</td></tr></table>
</center>
<br>
</td></tr>
<tr><td class="divider"></td>
</tr>
<tr>
<td class="userpanel"> <h2><strong>Class Management </strong></h2></td>
</tr>
<tr>
<td class="userpanel">
<form name="Staff_Login" method="post" action="../mytest/staff-be.php">
<table width="90%" border="0">
<tr>
<th width="14%" scope="col"><span class="style2">Staff Login</span> </th>
<th width="86%" scope="col"><div align="left">
<input type="text" name="ID">
</div></th>
</tr>
<tr>
<th scope="row"> </th>
<td>
<div align="left">
<input name="Log In" type="submit" id="Log In" value="Log In">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
The Staff - be page
<? include("../mytest/user.inc"); ?>
<? mytestDBConnect(); ?>
<?
if (isset($POST))
{
$query = mysql_query("select * from staff where ID='".$POST["id"]."'");
$error = mysql_error();
if ($error) { echo($error); }
$rows = mysql_num_rows($query);
if (!$rows)
{
header("Location: ../mytest/error.php?errorcode");
mytestDbClose();
die;
}
else
{
$result = mysql_fetch_row($query);
if ($rows)
{
$result = mysql_fetch_row($query);
$_SESSION["ID"] = $result[0];
$_SESSION["FirstName"] = $result[1];
$_SESSION["LastName"] = $result[2];
$_SESSION["Subject"] = $result[3];
$_SESSION["Subject1"] = $result[4];
$_SESSION["Subject2"] = $result[5];
$_SESSION["Subject3"] = $result[6];
}
}
}
?>
<? mytestDbClose(); ?>
<? header("Location: ../mytest/index.php?$result[1]"); ?>[/COLOR]
The Index Page
<? require("../mytest/user.inc"); ?>
** Note html coding is same as the staff page I took it out to fit everything in
<td class="userpanel"> <h2><strong>Class Management </strong></h2></td>
</tr>
<tr>
<td class="userpanel">
<?
if ($_SESSION["ID"])
{
print '<br><b>Teacher Options</b><br>';
print '<img src="bullet.gif"> <a href="absentee.php">Class Absentees</a><br><br>';
}
?>
</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
[/COLOR]
The Absentee Page
<? require("../mytest/user.inc"); ?>
<? require ("../mytest/database.inc"); ?>
<? require ("../mytest/subject.inc"); ?>
<html>
<head>
<title>Sacred Heart College - Login to the system </title>
<link rel="stylesheet" type="text/css" href="../mytest/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #336699;
}
.style1 {color: #336699}
-->
</style></head>
<body>
<table width="100%"
border="0" cellpadding="0" cellspacing="0" class="heading">
<tr><td height="119">
<center>
<table><tr><td><img src="../mytest/shcslogo.gif"
alt="logo"></td><td width="20"></td><td align="center" valign="center">
<br>
<span class="headingtext">Sacred Heart College<br>
Teacher Administration</span>
</td></tr></table>
</center>
<br>
</td></tr>
<tr><td class="divider"></td>
</tr>
<tr>
<td class="userpanel"> <h2><strong>Absentee System</strong></h2>
</td>
</table>
<table>
<tr>
<td class="maintablebody">
<?
$query = mysql_query('select * from staff where ID = "HE"');
$error = mysql_error();
if ($error) { echo($error); }
while ($result = mysql_fetch_row($query))
{
print '<td class="userpanel">';
print '<table width="90%" class="maintable"> ';
print '<tr class="maintablehead"><td width="50"></td> ';
print '<td width="130">Monday</td>';
print '<td width="130">Tuesday</td> ';
print '<td width="130">Wednesday</td> ';
print '<td width="130">Thursday</td> ';
print '<td width="130">Friday</td></tr>';
print '<tr class="maintablebody"><td width="50"></td> ';
print '<td><a href="showsubject.php?Subject='.$result[5].'">'.$result[5].'</a><br></td>';
print '<td><a href="showsubject.php?Subject='.$result[3].'">'.$result[3].'</a><br></td>';
print '<td><a href="showsubject.php?Subject='.$result[6].'">'.$result[6].'</a><br></td>';
print '<td><a href="showsubject.php?Subject='.$result[4].'">'.$result[4].'</a><br></td>';
}
?>
</td>
</tr>
</table>
</body>
</html>
The Show Subject Page
<? require("../mytest/user.inc"); ?>
<? require("../mytest/database.inc"); ?>
<? require ("subject.inc"); ?>
<html>
<head>
<title>Sacred Heart College - Class Absentee System </title>
<link rel="stylesheet" type="text/css" href="../mytest/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #336699;
}
.style1 {color: #336699}
-->
</style></head>
<body>
<table width="100%"
border="0" align="center" cellpadding="0" cellspacing="0" class="heading">
<tr><td height="119">
<center>
<table><tr><td><img src="../mytest/shcslogo.gif"
alt="logo"></td><td width="20"></td><td align="center" valign="center">
<br>
<span class="headingtext">Sacred Heart College<br>
Teacher Administration</span>
</td></tr></table>
</center>
<br>
</td></tr>
<tr><td class="divider"></td>
</tr>
<tr>
<td class="userpanel"> <h2><strong>Absentee System </strong></h2></td>
</tr>
<tr>
<td> <div align="center"></div></td>
<td><? Subject($REQUEST["Subject3"]); ?></td>
<td><? Subject($REQUEST["Subject"]); ?></td>
</tr>
</tr>
<tr>
<td>
</table>
<td><form action="class-be.php" method="post" name="Process" id="Process">
<?
mytestDbConnect();
$query = mysql_query('select * from year_10');
$error = mysql_error();
if ($error) { echo($error); }
print '<table class="maintable">
<tr class="maintablehead"></tr>';
while ($result = mysql_fetch_row($query))
{
print ' <tr>';
print '<tr> <td><input type="checkbox" name="checkbox" value="checkbox"> <td>'.$result[2].'</td><td>'.$result[1].'</td></tr>';
print '</tr>';
}
print '</table>';
myTestDbClose();
?>
<div align="left">
<blockquote>
<p>
<input type="submit" name="Submit" value="Send Absentees">
</th>
</table>
</p>
</blockquote>
</div>
</form> <p> </p></td>
</body>
</html>
[/COLOR]
The Class Page
<? require("../mytest/user.inc"); ?>
<? require("database.inc"); ?>
<? require ("subject.inc"); ?>
<html>
<head>
<title>Sacred Heart College - Class Absentee System </title>
<link rel="stylesheet" type="text/css" href="../mytest/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #336699;
}
.style1 {color: #336699}
-->
</style></head>
<body>
<table width="100%"
border="0" align="center" cellpadding="0" cellspacing="0" class="heading">
<tr><td height="119">
<center>
<table><tr><td><img src="../mytest/shcslogo.gif"
alt="logo"></td><td width="20"></td><td align="center" valign="center">
<br>
<span class="headingtext">Sacred Heart College<br>
Teacher Administration</span>
</td></tr></table>
</center>
<br>
</td></tr>
<tr><td class="divider"></td>
</tr>
<tr>
<td class="userpanel"> <h2><strong>Absentee System</strong></h2>
<? print '<a href="staff.php">Teacher Administration</a>'; ?>
</td>
</tr>
<tr>
<? print '<td class ="maintablebody">Your class absentees have been processed </td> '; ?>
</tr>
</table>
</body>
</html>
The Class - be page - meant to update the absentee table
<? require("../mytest/user.inc"); ?>
<? require("../mytest/subject.inc"); ?>
<?
if (isset($POST))
{
$query = "INSERT INTO absentee(LastName, FirstName, Subject) VALUES(".$POST[LastName].", ".$POST[FirstName].",".$POST[Subject].")";
$error = mysql_error();
if ($error)
{
echo($error);
die;
}
}
?>
<? header("Location: ../mytest/class.php"); ?>
Thanks for your help in this matter. It is very much appreciated