Location: PHPKode > projects > Helpdesk Over Web > how/assets/assetdetail.php
<?php

// Purpose : Allow viewing and editing of asset data.

// Include Configuration File
require_once ('../includes/config.inc'); 

// Set the page title and include the HTML header.
$page_title = 'Helpdesk Over Web - Asset Database';
include ('../includes/header.html');

// Connect to Database
require_once ('../includes/mysql_connect.php');
	
echo ("<H1>Asset Database</H1>");
echo ("<H3>Asset Record</H3>");
echo ("<P>Edit changes directly into fields. Asset tag is a read-only field and cannot be modified. Click Submit when done. A user can be removed by selecting the Delete option - note that user deletion occurs immediately and is irrecoverable!</P>");

$assettag = $HTTP_GET_VARS['selectedasset'];
$sql = "SELECT * FROM assets WHERE (assettag = '$assettag') ";
$records = range(1, 500);
$result = mysql_query($sql)
   or die("Invalid query: " . mysql_error());
list($assettag, $category, $manufacturer, $model, $purchasedate, $installdate, $user, $spec, $remarks) = mysql_fetch_row($result);

// Start outputting HTML code for table.
echo "<TABLE WIDTH='450' PADDING='2' SPACING='2'><FORM METHOD='POST' ACTION='editrecord-process.php?selecteduser=$user'>";
	echo "<TR><TD ALIGN='RIGHT'><B>Asset Tag:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='assettag' value='$assettag' size='20' maxlength='18' class='textbox'></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Category:</B></TD><TD>&nbsp;&nbsp;<SELECT NAME='category'>";
	$catsql = "SELECT HWCategoryText FROM hwcategories ORDER BY HWCategoryText;";
	$catlist = mysql_query($catsql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($catlist)) 
		{ 
		if($i[0] == $category)
			echo "<OPTION SELECTED VALUE='$i[0]'>$i[0]</OPTION>";
		else
			echo "<OPTION VALUE='$i[0]'>$i[0]</OPTION>";
		}
	echo "</SELECT></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Manufacturer:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='manufacturer' value='$manufacturer' size='60' maxlength='50' class='textbox'></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Model:</B></TD><TD>&nbsp;&nbsp;<input type='text' name='model' value='$model' size='60' maxlength='50' class='textbox'></TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Purchased:</B></TD><TD>&nbsp;&nbsp;<input type='text' value='$purchasedate' name='purchasedate' size='18' class='textbox'>&nbsp;&nbsp;(yyyy-mm-dd format)</TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>Installed:</B></TD><TD>&nbsp;&nbsp;<input type='text' value='$installdate' name='installdate' size='18' class='textbox'>&nbsp;&nbsp;(yyyy-mm-dd format)</TD></TR>";
	echo "<TR><TD ALIGN='RIGHT'><B>User:</B></TD><TD>&nbsp;&nbsp;<SELECT NAME='user'>";
	$usersql = "SELECT UserID, UserFirstname, UserSurname, Dept FROM users ORDER BY UserID;";
	$userlist = mysql_query($usersql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($userlist)) 
		{ 
		if($i[0] == $user)
			echo "<OPTION SELECTED VALUE='$i[0]'>$i[0] - $i[1] $i[2] ($i[3])</OPTION>";
		else
			echo "<OPTION VALUE='$i[0]'>$i[0] - $i[1] $i[2] ($i[3])</OPTION>";
		}
	echo "</SELECT></TD></TR>";
	echo "<TR><TD><B>Specification:</B></TD><TD>&nbsp;&nbsp;<textarea name='spec' cols='60' rows='5'>$spec</textarea></TD></TR>";
	echo "<TR><TD><B>Comments:</B></TD><TD> &nbsp;&nbsp;<textarea name='remarks' cols='60' rows='5'>$remarks</textarea></TD></TR>";
echo "<TR><TD COLSPAN='2' ALIGN='center'><BR><input type='submit' value='Submit'></TD></TR>";
echo "<TR><TD COLSPAN='2' ALIGN='center'><BR><H4><A HREF='deleteasset.php?selectedasset=$assettag'>Delete Asset</A></TD></TR>";
echo "</TABLE></FORM>";
echo "<H4>[ <A HREF='assetadmin.php'>Asset Database Administration</A> ]</H4>";
// Include standard HTML footer
include ('../includes/footer.html');
?>
Return current item: Helpdesk Over Web