This suppose to load my existing data to the form for editing. Yet, this is not the case, I still see the form empty why is it?
The present url: http://localhost/RustoleumCustomCMS/administrator/input_berita_static.php?id=0
//Load berita
if (!empty($_REQUEST['id'])){
$result = mysql_query("SELECT * FROM static_page WHERE id =".$_REQUEST['id']) or die(mysql_error());
$data = mysql_fetch_array($result);
$id = $data['id'];
$page = $data['page'];
$judul = $data['judul'];
$news = $data['isi_berita'];
}
//Simpan berita
if (isset($_REQUEST['ok'])){
if (empty($_REQUEST['id']))
$sqlstr = "INSERT INTO static_page(page, judul, isi_berita) VALUES('".$page."','".$judul."','".$news."')";
else
$sqlstr = "UPDATE static_page SET page='".$page."', judul='".$judul."', isi_berita='".$news."' 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" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<table>
<tr>
<td>Page</td>
<td><input size="50px" type="text" name="page" value="<?php echo $page; ?>"/></td>
</tr>
<tr>
<td>Judul</td>
<td><input size="50px" type="text" name="judul" value="<?php echo $judul; ?>"/></td>
</tr>
<tr>
<td valign="top">Isi berita</td>
<td>
<textarea cols="60" rows="10" id="news" name="news"><?php echo $news;?>