Hiya and thanks for the replies.
The open and closed form tags are from copying and pasting the code here, as this is just a snippet of the complete code.
I tried to use this code in the update.
php file, but it didn’t work.
- PHP: Select all
//This is the directory where images will be saved
$target = "http://www.webforumz.com/images/";
$target = $target . basename( $_FILES['photo']['name']);
QUERY (from the update.php code below)
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory <br><a href=\"view.php\">click here</a> to update another record<br>";
}
else {
//Gives and error if its not
echo "Sorry, there was a problem uploading your file <br><a href=\"addpropertyform.php\">click here</a> to add another Property<br>";
}
Below is the update.php code
- PHP: Select all
<?php
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname]=$value;
mysql_connect("host", "table", "password");
mysql_select_db("database");
echo "Record updated<br><a href=\"view.php\">click here</a> to update another record<br>";
$query="UPDATE property SET ".
"name= \"".$formVars["name"]."\",".
"photo= \"".$formVars["photo"]."\",".
"desc6= \"".$formVars["desc6"].
"\" WHERE id = \"".$formVars["id"]."\"";
mysql_query($query);
?>
Thanks for all the answers and help!!!