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

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

?>

<TITLE><?php echo $domain ?> - Edit News</TITLE>

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

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

<h3>Edit Assignments In Database:</h3><p>

<?php

// query the DB
$sql = "SELECT * FROM assignments WHERE assignments_id=$id";
$result = mysql_query($sql);	
$myrow = mysql_fetch_array($result);

if (isset($submit)) {

//process form
$sql2 = "DELETE FROM assignments WHERE assignments_id=$id";
$result = mysql_query($sql2);
echo "

Entered into database

.\n";

} else {

//display form

$sql3 = "SELECT * FROM teacher, assignments WHERE assignments.assignments_id = $id and assignments.teacher_id = teacher.teacher_id";
$result3 = mysql_query($sql3);
$myrow3 = mysql_fetch_array($result3);

$result4 = mysql_query("SELECT * FROM periods WHERE teacher_id = $teacherid",$db);

$sql5 = "SELECT * FROM assignments, periods WHERE assignments.assignments_id = $id and assignments.periods_id = periods.periods_id";
$result5 = mysql_query($sql5);
$myrow5 = mysql_fetch_array($result5);
?>

<form method="post">
<table width=500px border=0>
<tr>
<td>Teacher:
<td><?php echo $myrow["teacher_id"] ?> - <?php echo $myrow3["lastname"] ?>, <?php echo $myrow3["firstname"] ?>
<tr>
<td>Period:
<td><select name="periods_id">

<option value="<?php echo $myrow["periods_id"] ?>"><?php echo $myrow5["hournumber"] ?> - <?php echo $myrow5["classname"] ?></option>

<?php
while ($myrow4 = mysql_fetch_array($result4)) {
printf("<option value='%s'>%s - %s</option>\n", $myrow4["periods_id"], $myrow4["hournumber"], $myrow4["classname"]);
}
?>
<tr>
<td>Download:
<td><input type="text" id="text" name="download_id" value="<?php echo $myrow["download_id"] ?>">
<tr>
<td>Points:
<td><input type="text" id="text" name="points" value="<?php echo $myrow["points"] ?>">
<tr>
<td>Date Due:
<td><input type="text" id="text" name="datedue" value="<?php echo $myrow["datedue"] ?>">
<tr>
<td>Description:
<td><textarea rows="5" cols="55" id="text4" name="description" value="none"><?php echo $myrow["description"] ?></textarea>
<tr>
<td>Short Name:
<td><input type="text" id="text" name="shortname" value="<?php echo $myrow["shortname"] ?>">
</table>

<input type="Submit" name="submit" value="Delete Record">

</form>

<?php

}  //end if

?>

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