Hi,
I'm using the following code to update an entry in a table :
<?php
$HTTP_GET_VARS[´table´];
$HTTP_GET_VARS[´ID´];
$db = mysql_connect("localhost", "xxx");
mysql_select_db("xxx",$db);
if ($submit) {
$sql = "UPDATE $table SET URL=´$url´, SiteName=´$sitename´, Description=´$description´, Subcategory=´$subcategory´, Location=´$location´, Status=´$status´ WHERE ID=$ID";
}
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
$sql = "SELECT * FROM $table WHERE ID=$ID";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["ID"];
$url = $myrow["URL"];
$sitename = $myrow["SiteName"];
$description = $myrow["Description"];
$subcategory = $myrow["SubCategory"];
$location = $myrow["Location"];
$status = $myrow["Status"];
// print the id for editing
?>
<input type=hidden name="ID" value="<?php echo $ID ?>">
<input type=hidden name="table" value="<?php echo $table ?>">
URL:<input type="Text" name="URL" value="<?php echo $url ?>"><br>
SiteName:<input type="Text" name="SiteName" value="<?php echo $sitename ?>"><br>
Description:<input type="Text" name="Description" value="<?php echo $description ?>"><br>
SubCategory:<input type="Text" name="SubCategory" value="<?php echo $subcategory ?>"><br>
Location:<input type="Text" name="Location" value="<?php echo $location ?>"><br>
Status:<input type="Text" name="Status" value="<?php echo $status ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
The parameters that I send to the script from a previous web page are as follows :
editRecord.php3?table=Testinput&ID=1
The table entry is loaded into the form just fine, but when I hit the submit button, the entry doesn't get updated! No errors occur that I can see.
Any thoughts would be appreciated!
Thanks,
Mark