Dalam formulir enctype="multipart/form-data" tidak ada dan dalam formulir Anda tidak ada type="file".
Berikan kode di bawah ini dan coba.
<?php
require("db.php");
$id =$_REQUEST['theId'];
$result = mysql_query("SELECT * FROM table WHERE id = '$id'");
$test = mysql_fetch_array($result);
$name=$test['Name'] ;
$email= $test['Email'] ;
$image=$test['Image'] ;
if(isset($_POST['submit'])){
$name_save = $_POST['name'];
$email_save = $_POST['email'];
$image_save=$image //Added if image is not chose from the form post
if (isset($_FILES['image']['tmp_name'])) {
$file=$_FILES['image']['tmp_name'];
$image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name= addslashes($_FILES['image']['name']);
move_uploaded_file($_FILES["image"]["tmp_name"],"photos/" . $_FILES["image"]["name"]);
$image_save ="photos/" . $_FILES["image"]["name"];
}
mysql_query("UPDATE table SET Name ='$name_save', Email ='$email_save',Image ='$image_save' WHERE id = '$id'")
or die(mysql_error());
header("Location: index.php"); }
?>
<form method="post" enctype="multipart/form-data">
<table>
<tr>
<td>name:</td>
<td><input type="text" name="name" value="<?php echo $name ?>"/></td>
</tr>
<tr>
<td>email</td>
<td><input type="text" name="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td>image</td>
<td><input type="file" name="image" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
Selain itu, Anda harus mendapatkan nilai gambar sebelumnya melalui sql dan memperbarui jika gambar tidak dipilih saat memperbarui.