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

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

?>

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

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

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

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

<?php

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

$sql2 = "SELECT * FROM theme";
$result2 = mysql_query($sql2);	

$sql3 = "SELECT * FROM school";
$result3 = mysql_query($sql3);

if (isset($submit)) {

//process form
$sql2 = "UPDATE teacher SET school_id='$school_id',title='$title',lastname='$lastname',firstname='$firstname',phone='$phone',email='$email',teacherpass='$teacherpass',theme_id='$theme_id' WHERE teacher_id=$id";
$result = mysql_query($sql2);
echo "Thank you.  Your information has been updated.\n";

} else {

//display form

?>

<form method="post">
<table width=500px border=0>
<tr>
<td>School ID:
<td>

<select name="school_id">

<option value="<?php echo $myrow["school_id"] ?>">School #<?php echo $myrow["school_id"] ?></option>

<?php
while ($myrow3 = mysql_fetch_array($result3)) {
printf("<option value='%s'>%s - %s</option>\n", $myrow3["school_id"], $myrow3["school_id"], $myrow3["schoolname"]);
}
?>

<tr>
<td>Title:
<td><input type="text" id="text" name="title" value="<?php echo $myrow["title"] ?>">
<tr>
<td>Lastname:
<td><input type="text" id="text" name="lastname" value="<?php echo $myrow["lastname"] ?>">
<tr>
<td>Firstname:
<td><input type="text" id="text" name="firstname" value="<?php echo $myrow["firstname"] ?>">
<tr>
<td>Phone Number:
<td><input type="text" id="text" name="phone" value="<?php echo $myrow["phone"] ?>">
<tr>
<td>E-Mail Address:
<td><input type="text" id="text" name="email" value="<?php echo $myrow["email"] ?>">
<tr>
<td>Password:
<td><input type="text" id="text" name="teacherpass" value="<?php echo $myrow["teacherpass"] ?>">
<tr>
<td>Theme:
<td>
<select name="theme_id">

<option value="<?php echo $myrow["theme_id"] ?>">Theme #<?php echo $myrow["theme_id"] ?></option>

<?php
while ($myrow2 = mysql_fetch_array($result2)) {
printf("<option value='%s'>%s - %s</option>\n", $myrow2["theme_id"], $myrow2["theme_id"], $myrow2["themename"]);
}
?>


</table>

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

</form>

<?php

}  //end if

?>

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