Location: PHPKode > projects > Radtracker > radtracker/editissue.php
<?php
//This page allows the support staff to make changes to the original issue
//This is useful to make the description legible and useful for the knowledge base
include ("pagefunctions.php");
gentop("The Title");
//Checks to see if it was posted to itself for update
if ($stage==1)
	{
	$res=0;
	if ($resolved) $res=1;
	$sql_command = "update issue 
			set Description='$Description',
			Severity='$Severity',
			Category ='$Category',
			Contact='$Contact',
			Contactemail='$Contactemail',
			Contactphone ='$Contactphone',
			Resolution=$res,
			Costcenter ='$costcenter',                 
	                Building='$Building',
			Room='$Room',
			CompName='$CompName'
			Where IUID=$IUID"; 
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	}
?>
<form method="post" action="<?php print($serverhome . "$PHP_SELF?IUID=$IUID");?>">
<?php
$sql_command = "SELECT * FROM issue Where IUID=$IUID";
$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
//Get the record info to fill into the form
while ($row = mysql_fetch_array($sql_result))
	{
	$descrip=$row["Description"];
	$cat=$row["Category"];
	$serv=$row["Severity"];
	$contact=$row["Contact"];
	$contactemail=$row["Contactemail"];
	$contactphone=$row["Contactphone"];
	$costcen=$row["Costcenter"];
	$iuid=$row["IUID"];
	$res=$row["Resolution"];
	$build = $row["Building"];
	$room = $row["Room"];
	$compname = $row["CompName"];
	}
echo "<table align='left' border='1' cellpadding='2' cellspacing='2'>
	<tr><td><font size='2'>Name:</font></td><td><input type='text' value='$contact' name='Contact'></td></tr>
	<tr><td><font size='2'>Your Email:</font></td><td> <input type='text' value='$contactemail' name='Contactemail'></td></tr>
	<tr><td><font size='2'>Phone Number:</font></td><td> <input type='text' value='$contactphone' name='Contactphone'></td></tr>
	<tr><td><font size='2'>Problem Category:</font></td><td>
	<select name='Category' size='1'>
	<!-----Read Category----->";
//Pull all the categories back and match the one that was previously chosen.
$sql_command = "SELECT Category FROM category ORDER BY Category";
$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
while ($row = mysql_fetch_array($sql_result))
	 {
	$category = $row["Category"];
	$sel="";
	if ($category==$cat) $sel="selected";
	echo "<option $sel value=\"$category\">$category</option>";
	}
if ($serv=="Low") $lserv="selected";
if ($serv=="Medium") $mserv="selected";
if ($serv=="High") $hserv="selected";
echo "</select></td></tr><tr><td>Severity:</td><td>
	<select size='1' name='Severity'>
	<option $lserv value='low'>Low</option>
	<option $mserv value='medium'>Medium</option>
	<option $hserv value='high'>High</option></select></td></tr>";
echo "<tr><td><font size='2'>Description:</font></td></tr><tr><td align=middle colspan=2>
<textarea rows='5' cols='55' wrap='auto' name='Description'>$descrip</textarea></td></tr>";
echo "<tr><td><font size='2'>Area:</font></td><td><select size='1' name='Building'>";
//Pull all the building list and match the one that was previously chosen.
$sql_command = "SELECT Building FROM building ORDER BY Building";
$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
while ($row = mysql_fetch_array($sql_result))
	 {
	$building = $row["Building"];
	$sel="";
	if ($building==$build) $sel="selected";
	echo "<option $sel value=\"$building\">$building</option>";
	}
echo "</select></td></tr><tr><td><font size='2'>Room:</font></td><td>";
echo "<input type='text' value='$room' name='Room'></td></tr>";
echo "<tr><td><font size='2'>Computer Name or Asset Tag Number</font></td><td>
	<input type='text' value='$compname' name='CompName'></td></tr>
	<tr><td><font size='2'>Cost Center: (where applicable)</font></td><td>
	<select size='1' name='costcenter'>
	<option value='Unknown'>Unknown</option>";
//Pull up the costcenter list and select the previously chosen one.
$sql_command = "SELECT center FROM costcenter ORDER BY center";
$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
while ($row = mysql_fetch_array($sql_result))
	 {
	$center = $row["center"];
	$sel="";
	if ($center==$costcen) $sel="selected";
	echo "<option $sel value=\"$center\">$center</option>";
	}
echo "</select></td></tr>";
$check="";
if ($res==1) $check="checked";
echo "<tr><td><font size='2'>Problem Resolved</font></td><td><input $check type='checkbox' name='resolved'></td></tr>";
//hidden fields pass variables during self post
echo "<tr><td colspan=2 align=middle>
<input value=1 type='hidden' name='stage'>
<input value='$IUID' type='hidden' name='IUID'>
<input value='$luid' type='hidden' name='LUID'>
<input value='Update Information' type='submit'></td></tr></table>";
genbottom();
?>
Return current item: Radtracker