Hello,
I wonder why when you try to when you try to update location (lokasi) to Product1 it always saved as Home ?
input_berita_static.php
<?php
include('../includes/koneksi.php');
$id = isset($_POST['id']) ? $_POST['id'] : '';
$confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';
$kategori = isset($_POST['kategori']) ? $_POST['kategori'] : '';
$news = isset($_POST['news']) ? $_POST['news'] : '';
$judul = isset($_POST['judul']) ? $_POST['judul'] : '';
$page = isset($_POST['page']) ? $_POST['page'] : '';
$lokasi = isset($_POST['lokasi']) ? $_POST['lokasi'] : '';
//Load berita
if (!empty($_GET['id'])){
$result = mysql_query("SELECT * FROM page WHERE id =".$_GET['id']) or die(mysql_error());
$data = mysql_fetch_array($result);
$id = $data['id'];
$judul = $data['judul'];
$lokasi = $data['lokasi'];
$news = $data['isi_berita'];
}
else {
echo "unable to select data";
echo "id is empty";
}
//Simpan berita
if (isset($_POST['ok'])){
if (empty($_POST['id']))
{
$sqlstr = "INSERT INTO page(judul, lokasi, isi_berita) VALUES('".$judul."','".$lokasi."','".$news."')";
}
else
{
$sqlstr = "UPDATE page SET judul='".$judul."', lokasi='".$lokasi."', isi_berita='".$news."' WHERE id=".$_POST['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" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<table>
<tr>
<td>Page</td>
<td><select name="judul">
<option value="Pengenalan Perusahaan">Pengenalan Perusahaan</option>
<option value="Sejarah Perusahaan">Sejarah Perusahaan</option>
<option value="Cabang">Cabang</option>
</select></td>
<?php // <input size="50px" type="text" name="page" value="<?php echo $page; ?"/> ?>
</tr>
<tr>
<td>Lokasi</td>
<td><select name="lokasi">
<option value="Home">Home</option>
<option value="Product1">Product1</option>
<option value="Product2">Product2</option>
<option value="Product3">Product3</option>
<option value="Product4">Product4</option>
<option value="Product5">Product5</option>
<option value="Product6">Product6</option>
<option value="Product7">Product7</option>
<option value="Product8">Product8</option>
</select></td>
</tr>
<tr>
<td valign="top">Isi berita</td>
<td>
<textarea cols="60" rows="10" id="news" name="news"><?php echo $news;?></textarea>
<script type="text/javascript">
var editor = CKEDITOR.replace('news');
</script> </td>
</tr>
<tr>
<td><input type="submit" name="ok" value="Simpan"/></td>
</tr>
</table>
</form>
</div>
</div>