<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
<link rel="stylesheet" href="css/opencabling.css" type="text/css"></link>
<?php
require_once 'js/functions.js';
?>
</head>
<body>
<?php
$object=$_REQUEST['object'];
$field=$_REQUEST['field'];
$newvalue=$_REQUEST['newvalue'];
$action=$_REQUEST['action'];
include "opendb.php";
if ($action=="Submit") {
$sql="update objects set $field='$newvalue' where id_object='$object'";
$query=mysql_query($sql,$mysql_conn);
print "<script lang=javascript>";
print "opener.document.location.reload();";
print "self.close();";
print "</script>";
} else {
$sql="select * from objects where id_object='$object'";
$query=mysql_query($sql,$mysql_conn);
if (mysql_num_rows($query)>0) {
$result=mysql_fetch_assoc($query);
print "<form name=edit_object method=post>";
print "<table align=center><tr><td colspan=2>";
print "<textarea cols=40 rows=10 name=newvalue>".$result[$field]."</textarea></td>";
print "<tr><td align=left></input><input type=reset value='Reset'></input></td>";
print "<td align=right><input type=submit name=action value='Submit'></input></td></tr>";
print "</table></form>";
}
// DEBUG
print "<!--";
print "Action: <".$action.">";
print_r($_REQUEST);
print "-->";
}
?>
</body>
</html>