Hi guys,
Just looking for help to achieve this little task. I have two pages one is called tech.php and the other is details.php.
tech.php displays a list of jobs that the user has requested. there is a dynamic hyperlink for each job that links to details.php to give more details about the job and allow a technican to record the action he/she has taken to fix the the job. when the job is complete eg when the technican ticks the check box and submits it. the job should dissapear from tech.php.
can anyone help with this ?
below is details.php
<html>
<head>
</head>
<body>
<?php
require('dbconnect.php');
set_time_limit(0);
$jobId=$_GET['jobId'];
$sql = "select jobId, email, room, computers, description, date FROM requests_table
WHERE requests_table.jobId='$jobId'";
$result = mysql_query($sql);
echo "<H3><b>Faults and Requests</b></H3>";
echo "<table width=\"100%\">\n";
echo " <tr>\n";
echo " <th align=\"left\"><b>JobID</b></th>\n";
echo " <th align=\"left\"><b>Email</b></th>\n";
echo " <th align=\"left\"><b>Room</b></th>\n";
echo " <th align=\"left\"><b>Computers</b></th>\n";
echo " <th align=\"left\" ><b>Description</b></th>\n";
echo " <th align=\"left\"><b>Date&time</b></th>\n";
echo " </tr>\n";
$row = mysql_fetch_array($result);
echo '<td>'.$row['jobId'].'</td>';
echo '<td >'.$row['email'].'</td>';
echo '<td>'.$row['room'].'</td>';
echo ' <td>'.$row['computers'].'</td>'."\n";
echo ' <td>'.$row['description'].'</td>'."\n";
echo ' <td>'.$row['date'].'</td>'."\n";
echo '</tr>'."\n";
echo '</table>';
echo '<hr>';
?>
<?php
$color[0] = "FCFCFC";
$color[1] = " 34ADE5 ";
$jobId=$GET['jobId'];
$action_taken=$GET['action_taken'];
$Tech_initals=$_GET['Tech_intials'];
if($_POST["Submit1"]) {
$action_taken = addslashes($POST['action_taken']);
$Tech_initals = addslashes($POST['Tech_initals']);
$result = mysql_query("INSERT INTO tech_table (jobId, Tech_initals, action_taken, date)
VALUES ('$jobId', '$Tech_initals', '$action_taken', NOW())") or die("Unable to insert record: " . mysql_error());
}
$sql = "SELECT jobId, Tech_initals, action_taken, date FROM tech_table WHERE jobId='".$_GET['jobId']."'";
$result = mysql_query($sql);
echo "<H3><b>Job History</b></H3>";
echo "<table>\n";
echo " <tr>\n";
echo " <th><b>Tech Initals</b></th>\n";
echo " <th><b>Action taken</b></th>\n";
echo " <th><b>Date</b></th>\n";
echo " <th><b>Status of Job</b></th>\n";
echo " <th><b>Date of completion</b></th>\n";
echo " </tr>\n";
while ($row = mysql_fetch_array($result)) {
$a = ($a+1)%2;
echo '<tr bgcolor='.$color[$a] . ">\n";
//echo '<td>'.$row['jobId'].'</td>';
echo ' <td>'.$row['Tech_initals'].'</td>'."\n";
echo ' <td>'.$row['action_taken'].'</td>'."\n";
echo ' <td>'.$row['date'].'</td>'."\n";
echo ' <td>'.$row['status_of_job'].'</td>'."\n";
echo ' <td>'.$row['compdate'].'</td>'."\n";
echo '</tr>'."\n"; }
echo '</table>';
?>
</table>
<?php
if (strlen($POST['email']) > 0 ) {
$sql = "SELECT email FROM requests_table WHERE jobId='".$GET['jobId']."'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$to = $row['email'];
$from = "poo@ntlworld.com";
$message = $_POST['email'];
mail($to, "technical services", $message,
"From: {$from}\r\n"
."Reply-To: {$from}\r\n"
."X-Mailer: PHP/" . phpversion());
}
?>
<br>
<?php
echo '<hr>';
?>
<?php
echo "<H3><b> Technican Feedback</b></H3>";
?>
<br>
<form name="details" method="post" action= "<? echo $_SERVER['PHP_SELF'] . "?jobId=" . $jobId; ?>">
<table width="791" height="160" border="0">
<tr>
<input type="hidden" name="email">
<th width="61" scope="row">TechId</th>
<td width="245"><strong>Action taken </strong></td>
<td width="116"><strong>Status of job </strong></td>
<td width="120"> </td>
<td width="126"> </td>
<td width="97"> </td>
</tr>
<tr>
<th scope="row"><input name="Tech_initals" type="text" size="2" maxlength="2"></th>
<td><textarea name="action_taken" cols="30" rows="3"></textarea></td>
<td><input type="checkbox" name="comp" value="1"></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row"> </th>
<td><strong>Email comment </strong></td>
</tr>
<tr>
<th scope="row"> </th>
<td><textarea name="email" cols="30" rows="3"></textarea></td>
</tr>
</tr>
<tr>
<th scope="row"> </th>
<td><input type="submit" name="Submit1" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>