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

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

?>

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

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

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

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

<?php

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

if (isset($submit)) {

//process form
$sql2 = "UPDATE calendar SET stamp='$stamp',timeofday='$timeofday',subject='$subject',description='$description' WHERE id=$id";
$result = mysql_query($sql2);
echo "Thank you.  Your information has been updated.\n";

} else {

//display form

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

?>

<form method="post">
<table width=500px border=0>
<tr>
<td>Teacher ID:
<td><?php echo $myrow["teacher_id"] ?> - <?php echo $myrow3["lastname"] ?>, <?php echo $myrow3["firstname"] ?>
<tr>
<td>Date:
<td><input type="text" id="text" name="stamp" value="<?php echo $myrow["stamp"] ?>">
	<input type=radio name="timeofday" <?php if ($myrow["timeofday"] == "am") printf("checked\n"); else printf("&nbsp;\n"); ?> value="am">AM
	<input type=radio name="timeofday" <?php if ($myrow["timeofday"] == "pm") printf("checked\n"); else printf("&nbsp;\n"); ?>value="pm">PM
<tr>
<td>Subject:
<td><input type="text" id="text" name="subject" value="<?php echo $myrow["subject"] ?>">
<tr>
<td>Message:
<td><textarea rows="5" cols="55" id="text4" name="description" value="none"><?php echo $myrow["description"] ?></textarea>

</table>

<input type="Submit" name="submit" value="Enter Information">

</form>

<?php

}  //end if

?>

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