Location: PHPKode > projects > OpenCabling > opencabling/edit_extra.php
<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'];
$extra=$_REQUEST['extra'];
$oldvalue=$_REQUEST['oldvalue'];
$newvalue=$_REQUEST['newvalue'];
$action=$_REQUEST['action'];

include "opendb.php";
     
     if ($action=="Submit") {
       $extras=explode(";",$oldvalue);
       array_unshift($extras,"");
       $extras[$extra]=$newvalue;
       array_shift($extras);
       $anewvalue=implode(";",$extras);
       $sql="update objects set obj_extravalues='$anewvalue' 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);
	 $extras=explode(";",$result['obj_extravalues']);
	 array_unshift($extras,"");
	 print "<form method=post>";
	 print "<table align=center><tr><td colspan=2>";
	 print "<input type=text cols=10 name=newvalue value='".$extras[$extra]."'></input>";
	 print "<input type=hidden name=oldvalue value='".$result['obj_extravalues']."'></inputy></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>";
       }
     }
?>
     </body>
     </html>
Return current item: OpenCabling