Hi,
When I try to save the form I wonder why location and description remains empty. I already fill the form with the necessary information.
input_image.php
<?php
include('../includes/koneksi.php');
$id = isset($_POST['id']) ? $_POST['id'] : '';
$confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';
$productname = isset($_POST['productname']) ? $_POST['productname'] : '';
$location = isset($_POST['location']) ? $_POST['location'] : '';
$description = isset($_POST['description']) ? $_POST['description'] : '';
$urlimages = isset($_POST['urlimages']) ? $_POST['urlimages'] : '';
//Load berita
if (!empty($_REQUEST['id'])){
$result = mysql_query("SELECT * FROM gallery WHERE id =".$_REQUEST['id']) or die(mysql_error());
$data = mysql_fetch_array($result);
$id = $data['id'];
$productname = $data['productname'];
$location = $data['location'];
$description = $data['description'];
$urlimages = $data['urlimages'];
}
//Simpan berita
if (isset($_REQUEST['ok'])){
if (empty($_REQUEST['id']))
$sqlstr = "INSERT INTO gallery(productname, location, description, urlimages) VALUES('".$productname."','".$location."','".$description."','".urlimages."')";
else
$sqlstr = "UPDATE gallery SET productname='".$productname."', image='".$location."', description='".$description."', urlimages='".$urlimages."' WHERE id=".$_REQUEST['id'];
$result = mysql_query($sqlstr) or die(mysql_error());
//Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
//if (empty($_REQUEST['id'])) kirimEmail($idKategori, $judul, $news);
$confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";
}
?>
<div align="center">
<div style="width:800px;text-align:left;">
<script type="text/javascript" src="../../Masterlink/cgoods/ckeditor/ckeditor.js"></script>
<link href="../../Masterlink/cgoods/ckeditor/content.css" rel="stylesheet" type="text/css"/>
<?php echo $confirmation;?>
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<table>
<tr>
<td>Product Name : </td>
<td><input size="30px" type="text" name="productname" value="<?php echo $productname; ?>"/></td>
</tr>
<tr>
<td>Location :</td>
<td><select name="location">
<option value="pic1">pic1</option>
<option value="pic2">pic2</option>
<option value="pic3">pic3</option>
<option value="pic4">pic4</option>
<option value="pic5">pic5</option>
<option value="pic6">pic6</option>
<option value="pic7">pic7</option>
<option value="pic8">pic8</option>
</select></td>
</tr>
<tr>
<td>Description : </td>
<td><textarea rows="4" cols="50"/></textarea></td>
</tr>
<tr>
<td>Url Images: </td>
<td><input size="30px" type="text" name="judul" value="<?php echo $urlimages; ?>"/></td>
</tr>
<td>Images: </td>
<td><input size="30px" type="file" name="image" value="<?php echo $image; ?>"/></td>
<tr><?php // showing the picture ?>
<td><img src="photos/<?php echo $image; ?>"/></td>
</tr>
<tr>
<td><input type="submit" name="ok" value="Simpan"/></td>
</tr>
</table>
</form>
</div>
</div>