Location: PHPKode > projects > Helpdesk Over Web > how/calls/editcall.php
<?php

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

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

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

// Connect to Database
require_once ('../includes/mysql_connect.php');
	
echo ("<H1>Call Management</H1>");
echo ("<H3>Call Record</H3>");

$callid = $HTTP_GET_VARS['callid'];
$sql = "SELECT * FROM `calls` WHERE (`calls`.`callid` = '$callid') ";
$records = range(1, 500);
$result = mysql_query($sql)
   or die("Invalid query: " . mysql_error());
list($callid, $date, $time, $user, $asset, $fault, $worklog, $severity, $category, $callstatus, $engineer) = mysql_fetch_row($result);

// Start outputting HTML code for table.
echo "<FORM METHOD='POST' ACTION='editcall-process.php'>";
echo "<TABLE WIDTH='450' PADDING='2' SPACING='4'>";
echo "<TR><TD ALIGN='RIGHT'><B>Call ID:</B></TD><TD>&nbsp;&nbsp;$callid</TD></TR>";
echo "<INPUT TYPE='hidden' NAME='callid' VALUE='$callid'>";
echo "<TR><TD ALIGN='RIGHT'><B>Date/Time:</B></TD><TD>&nbsp;&nbsp;$time on $date.</TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>User:</B></TD><TD>&nbsp;&nbsp;<A HREF='/how/users/userdetail.php?selecteduser=$user' TARGET='_new'>$user</A></TD></TR>";
echo "<TR><TD ALIGN='RIGHT'><B>Asset Tag:</B></TD><TD>&nbsp;&nbsp;<A HREF='/how/assets/assetdetail.php?selectedasset=$asset' TARGET='_new'>$asset</A></TD></TR>";
echo "<TR><TD ALIGN='RIGHT' VALIGN='top'><B>Fault:</B></TD></TR>";
echo "<TR><TD ALIGN='RIGHT' VALIGN='top'><TD><textarea name='fault' cols='50' rows='6'>$fault</textarea></TD></TR>";
echo "<TR><TD ALIGN='RIGHT' VALIGN='top'><B>Work Log:</B></TD></TR>";
echo "<TR><TD ALIGN='RIGHT' VALIGN='top'></TD><TD><textarea name='worklog' cols='50' rows='6'>$worklog</TEXTAREA></TD></TR>";
echo "<TR><TD><B>Call Status:</B></TD><TD> &nbsp;&nbsp;<select name='callstatus'>";
	$sql = "SELECT * FROM statcategories ORDER BY StatusText;";
	$statlist = mysql_query($sql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($statlist)) 
		{ 
		if($i[1] == $callstatus)
			echo "<OPTION SELECTED>$i[1]</OPTION>";
		else
			echo "<OPTION >$i[1]</OPTION>";
		}
echo "</SELECT></TD></TR>";
echo "<TR><TD><B>Category:</B></TD><TD> &nbsp;&nbsp;<select name='category'>";
	$sql = "SELECT * FROM kbcategories ORDER BY CategoryText;";
	$sevlist = mysql_query($sql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($sevlist)) 
		{ 
		if($i[1] == $category)
			echo "<OPTION SELECTED>$i[1]</OPTION>";
		else
			echo "<OPTION>$i[1]</OPTION>";
		}
echo "</SELECT></TD></TR>";
echo "<TR><TD><B>Severity:</B></TD><TD> &nbsp;&nbsp;<select name='severity'>";
	$sql = "SELECT * FROM sevcategories ORDER BY SeverityText;";
	$sevlist = mysql_query($sql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($sevlist)) 
		{ 
		if($i[1] == $severity)
			echo "<OPTION SELECTED>$i[1]</OPTION>";
		else
			echo "<OPTION >$i[1]</OPTION>";
		}
echo "</SELECT></TD></TR>";
echo "<TR><TD><B>Engineer:</B></TD><TD> &nbsp;&nbsp;<select name='engineer'>";
	$sql = "SELECT * FROM systemusers WHERE Role LIKE 'Engineer%' OR Role LIKE 'Helpdesk Manager%' ORDER BY HOWLogin;";
	$engrlist = mysql_query($sql)
	   or die("Invalid query: " . mysql_error());
	while($i = mysql_fetch_row($engrlist)) 
		{ 
		if($i[0] == $engineer)
			echo "<OPTION SELECTED VALUE='$i[0]'>$i[0] - $i[4] ($i[5])</OPTION>";
		else
			echo "<OPTION VALUE='$i[0]'>$i[0] - $i[4] ($i[5])</OPTION>";
		}
echo "</SELECT></TD></TR>";
// Hidden Variables to ensure data is passed to form processor.
echo "<INPUT TYPE='hidden' NAME='callid' VALUE='$callid'>";
echo "<INPUT TYPE='hidden' NAME='date' VALUE='$date'>";
echo "<INPUT TYPE='hidden' NAME='time' VALUE='$time'>";
echo "<INPUT TYPE='hidden' NAME='user' VALUE='$user'>";
echo "<INPUT TYPE='hidden' NAME='asset' VALUE='$asset'>";
echo "<TR><TD COLSPAN='2' ALIGN='center'><BR><input type='submit' value='Submit Changes'></TD></TR>";
echo "</TABLE></FORM>";

echo "<H4>[ <A HREF='calladmin.php'>Call Administration Main Page</A> ]</H4>";
// Include standard HTML footer
include ('../includes/footer.html');
?>
Return current item: Helpdesk Over Web