Thanks for your help yesterday however, I still have an issue.
When coding the header("Location: crd_database.php"); after the SELECT it takes me straight to the crd_database page before the user has had a chance to update the fields from the SELECT.
What I want is for the select to populate the form, then have the chance to update the form and then on the submit of the changes it updates the table again and goes off to the crd_database page.
Coding the header("Location: crd_database.php"); at the end gives me an error -
Warning: Cannot modify header information - headers already sent by etc etc
Here is the current coding (apologies not sure how to block the code as per previous posts)
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
if (isset($_GET['id'])) {
$id = $_GET['id'];
$tor = $_GET['tor'];
}
$query = "SELECT genid, RequestorName FROM request_detail_t WHERE genid='$id'";
//$genid = $row["genid"];
//$RequestorName =$row["RequestorName"];
header("Location: crd_database.php");
echo '
<form method="post" action="'.$_SERVER["PHP_SELF"].'" />
<table width="600" border="0" cellpadding="1">
<tr>
<td width="165">Identifier:</td>
<td><input name="genid" type="text" size="52" value="'.$id.'"></td>
</tr>
<tr>
<td width="165">Requestor Name:</td>
<td><input name="RequestorName" type="text" size="52" value="'.$tor.'"></td>
</tr>
<tr>
<td width="100"> </td>
<td> </td>
</tr>
<tr>
<td width="100"> </td>
<td><input name="update" type="submit" id="add" class="button" value="edit" ></td>
</tr>
</form>';
$genid= $_POST["genid"];
$RequestorName = $_POST["RequestorName"];
$update = "UPDATE request_detail_t SET genid ='$genid', RequestorName='$RequestorName' WHERE genid='$genid'";
$result = mysql_query($update) or die('Error, update query failed');
?>