I have some errors while trying to fix the following codes:
update_image2.php
<?php
//LOAD IMAGE TABLE
if (!empty($_GET['image_id'])){
$result = mysql_query("SELECT * FROM image_upload WHERE image_id='".$_GET['image_id']."'") or die(mysql_error());
$data = mysql_fetch_array($result);
$image_id = $_GET['image_id'];
$newfilename = $data['newfilename'];
$class = $data['class'];
$location = $data['location'];
$minwidth = $data['minwidth'];
$maxwidth = $data['maxwidth'];
$minheight = $data['minheight'];
$maxheight = $data['maxheight'];
}
else {
//echo "unable to select data".'<br>';
//echo "package_id is empty";
$image_id = "";
$newfilename = "";
$class = "";
$location = "";
$minwidth = "450";
$maxwidth = "550";
$minheight = "600";
$maxheight = "700";
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?image_id='. $image_id;?>" enctype="multipart/form-data">
<b>Class name :</b> <input type="text" name="class" value="<?php echo $class; ?>"><br><br><br>
<?php
echo '<div id="location"><b>Location: <input type="text" size="50px" name="location" value="'.$location.'" disabled></b></div><br><br><br>';
echo '<input type="text" size="30px" name="location" value="'.$location.'" hidden>';
echo '<div id="size"><b>min width: <input type="text" size="10px" name="size" value="'.$minwidth.'px" disabled></b></div><br><br><br>';
echo '<div id="size"><b>max width: <input type="text" size="10px" name="size" value="'.$maxwidth.'px" disabled></b></div><br><br><br>';
echo '<div id="size"><b>min height: <input type="text" size="10px" name="size" value="'.$minheight.'px" disabled></b></div><br><br><br>';
echo '<div id="size"><b>max height: <input type="text" size="10px" name="size" value="'.$maxheight.'px" disabled></b></div><br><br><br>';
echo $data['image'];
echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></updateimage>';
echo '<br><br><br>.<input type="file" value="upload" name="file"/><br><br>';
?>
Notice: Undefined variable: data in C:\xampp\htdocs\portal\administrator2\admin\update_image2.php on line 407
Notice: Undefined variable: data in C:\xampp\htdocs\portal\administrator2\admin\update_image2.php on line 409
echo $data['image'];
echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></updateimage>';