Mantis, you are the man! Trust me, who the man? You d man. Sorry if your a female, in which case you'd be the woman.:D
That worked a treat m8, thank you very much for all your replies and undoubtedly needed help.
Just so happens, im strugling on another problem regarding updating one of my databases. I update a form, i press submit and I get no errors.
BUT the database wont update. I have not come across a problem like this before as all of my other databases update without fail.
Here's the code, if you don't mind taking a look.
--------------------------
<?
session_start();
?>
<?
include "conn.inc.php";
$query ="SELECT * FROM admin WHERE AdminID= '" . $_SESSION['admin_logged']."'
AND password =(password('" . $_SESSION['admin_password'] . "'));";
$result = mysql_query($query) or die(mysql_error());
$new = mysql_fetch_array($result);
?>
<html>
<head>
<title>Fault Reporting System : : Complete A Call</title>
<body background="h.gif">
<body>
<br>
<div align="center"><h2>Welcome <? echo $new['First_Name']; ?>.<br> Please Select A Call You Would Like To Complete</h2></div>
<br>
<?
include "conn1.inc.php";
$q1 = "SELECT FaultID, AdminID, StaffID, Location, Problem_Desc,
Date, Technician_Comment, Progress, Complete
FROM FAULT
WHERE AdminID= '" . $_SESSION['admin_logged']."'
AND Progress = 'Ongoing'";
$result = mysql_query($q1) or die(mysql_error());
$ans= mysql_num_rows($result);
?>
<?
// updating the database
include "conn1.inc.php";
if ($_POST['submit'] == "Update")
{
if ($_POST['AdminID'] != "" && $_POST['Technician_Comment'] != "" &&
$_POST['Progress'] != "")
$q8 = "INSERT INTO Fault(Technician_Comment, Progress)
VALUES('" . $_POST['Techncian_Comment'] . "', '" . $_POST['Progress'] . "');";
$result = mysql_query($q8) or die(mysql_error());
$_SESSION['admin_logged'] = $_POST['AdminID'];
$_SESSION['admin_password'] = $_POST['password'];
}
?>
<?
//EOD, all table variables held between EOD statements;
$progress_table=<<<EOD
<div align="center"><h4>Here Are Your Outstanding Calls</h4></div>
<form action="Fault_All_My_Completed_Calls.php" method="post">
<table width="100%" border="5" cellpadding="1" cellspacing="1" align="center">
<tr>
<th>FaultID</th>
<th>AdminID</th>
<th>StaffID</th>
<th>Location</th>
<th>Problem Description</th>
<th>Technician Comment</th>
<th>Date</th>
<th>Progress</th>
</tr>
EOD;
while($row = mysql_fetch_array($result))
{
$FaultID = $row['FaultID'];
$AdminID = $row['AdminID'];
$StaffID = $row['StaffID'];
$Location = $row['Location'];
$Problem_Desc = $row['Problem_Desc'];
$Technician_Comment = $row['Technician_Comment'];
$Date = $row['Date'];
$Progress = $row['Progress'];
$progress_table_info .=<<<EOD
<tr>
<td>$FaultID</td>
<td>$AdminID</td>
<td>$StaffID</td>
<td>$Location</td>
<td>$Problem_Desc</td>
<td><select name="Technician_Comment">
<option value="" SELECTED>Select Comment...</option>
<option value="Working fine now">Working fine now</option>
<option value="Sent back to manufacturer">Sent back to manufacturer</option>
<option value="3rd party coming in to look at it">3rd party coming in to look at it</option>
<option value="Need more time">Need more time</option>
</select></td>
<td>$Date</td>
<td><select name="Progress">
<option value="" SELECTED>Select Progress...</option>
<option value="Ongoing">Ongoing</option>
<option value="Complete">Complete</option>
</select></td>
</tr>
EOD;
}
$progress_table_info .=<<<EOD
<tr>
<td> </td>
EOD;
$progress_table_end ="</table>";
$progress =<<<PROGRESS
$progress_table
$progress_table_info
$progress_table_end
PROGRESS;
echo $progress;
?>
<br>
<br>
<input type="submit" name="submit" value="Submit">
<input type="reset" value="Clear">
</body>
</html>
----------------------------
Some of the information is just called via the form and displayed. I then have x2 areas which i want to update, the TECHNICIAN COMMENT, where i select a comment from a drop down menu. And the other is the PROGRESS, where i want to also select either ongoing or complete from the drop down menu.
When i make my selections and press submit, it looks as though it updates the database, but it does not. Although the clear button works.
Anyways, hope you have the same luck with the new problem as the last.
Once again, thank you very much for your help with the last problem, and to anyone else who replied to the original message.
H.
|