Location: PHPKode > projects > PortalXP - Teacher Edition > PortalXP/PortalXP/admin/addassignments.php
<?PHP

require('config.php');
require('connect.php');

?>

<TITLE><?php echo $domain ?> - Add Assignment</TITLE>

<? INCLUDE("top-mini.php")?>

<link REL="stylesheet" TYPE="text/css" HREF="../portalxp.css">

<h3>Add Assignment To Database:</h3><p>

<?php

if (isset($submit)) {

//process form
$sql = "INSERT INTO assignments (teacher_id,periods_id,download_id,points,datedue,description,shortname,visible) VALUES ('$teacher_id','$periods_id','$download_id','$points','$datedue','$description','$shortname','$visible')";
$result = mysql_query($sql);
echo "Thank you.  Your information has been entered.\n";

} else {

//display form

$sql2 = "SELECT firstname, lastname FROM teacher WHERE teacher_id = $id";
$result2 = mysql_query($sql2);	
$myrow2 = mysql_fetch_array($result2);

$result3 = mysql_query("SELECT * FROM periods WHERE teacher_id = $id",$db);

$result4 = mysql_query("SELECT * FROM downloads WHERE teacher_id = $id",$db);
?>

<form method="post" action="<?php echo $PHP_SELF?>">
<table width=500px border=0>
<tr>
<td>Teacher ID:
<td><?php echo $id ?> - <?php echo $myrow2["lastname"] ?>, <?php echo $myrow2["firstname"] ?>
<tr>
<td>Period:
<td><select name="periods_id">

<option>Select One</option>

<?php
while ($myrow = mysql_fetch_array($result3)) {
printf("<option value='%s'>%s - %s</option>\n", $myrow["periods_id"], $myrow["hournumber"], $myrow["classname"]);
}
?>
<tr>
<td>Download:
<td><select name="download_id">

<option>Select One</option>
<option value='0'>No Download File</option>
<?php
while ($myrow4 = mysql_fetch_array($result4)) {
printf("<option value='%s'>%s - %s</option>\n", $myrow4["download_id"], $myrow4["filename"], $myrow4["uploaddate"]);
}
?>
<tr>
<td>Points Possible:
<td><input type="text" id="text" name="points">
<tr>
<td>Date Due:
<td><input type="text" id="text" name="datedue">
<tr>
<td>Description:
<td><input type="text" id="text" name="description">
<tr>
<td>Short Name:
<td><input type="text" id="text" name="shortname">
<tr>
<td>Visible:
<td><input type="radio" name="visible" checked value="1">Yes<br>
	<input type="radio" name="visible" value="0">No<br>

</table>
<input type="Hidden" name="teacher_id" value="<?php echo $id ?>">
<input type="Submit" name="submit" value="Enter Information">
</form>

<?php

}  //end if

?>

<? INCLUDE("bottom.php")?>
Return current item: PortalXP - Teacher Edition