Hey, out of the following codes:
product_edit.php
<h2><center>Product Preview</center></h2>
<p></p>
<?php
$data = array();
if(!empty($_GET['id']))
{
$result = mysql_query("SELECT * FROM produk AS p, kategori AS k WHERE id_produk='".mysql_real_escape_string($_GET['id'])."'AND p.id_kategori = k.id_kategori") or die(mysql_error());
$data = mysql_fetch_array($result);
}
else
{
$data['nama_produk'] = '';
$data['nama_kategori'] = '';
$data['harga'] = '';
$data['deskripsi'] = '';
$data['gambar'] = '';
}
?>
<form method = "POST" enctype="multipart/formdata" action = "<?php $_SERVER['PHP_SELF']; ?>">
<table border="0" cellpadding="2">
<tr>
<td>Nama</td>
<td><input name="nama" size="20px" type="text" value =<?php echo $data['nama_produk']; ?>>
</tr>
<tr>
<td>Kategori</td>
<td><select name="kategori"><option value=<?php echo $data['nama_kategori']; ?> selected><?php echo $data['nama_kategori']; ?></option>
<?php
$resultCOMBO = mysql_query("SELECT nama_kategori FROM kategori") or die(mysql_error()); while($dataCOMBO = mysql_fetch_array($resultCOMBO)){
echo "<option value={$dataCOMBO['nama_kategori']}>{$dataCOMBO['nama_kategori']}</option>";
}?>
</select>
</td>
</tr>
<tr>
<td>Harga</td>
<td><input name="harga" type="text" value = <?php echo $data['harga']; ?>></td>
</tr>
<tr>
<td>Deskripsi</td>
<td>
<textarea name="deskripsi" cols="30" rows="15" value= <?php echo $data['deskripsi']; ?></textarea>
<script type="text/javascript">
var editor = CKEDITOR.replace('deskripsi');
</script> </td>
</tr>
<tr>
<td>Gambar</td>
<td><img src="foto_produk/<?php echo $data['gambar'];?>" width="30%" height="30%" /></td>
</tr>
<tr>
<td>Ganti Gambar</td>
<td>
<input name="uploaded_file" type="file" value="Browse" /></td>
</form>
</tr>
<tr>
<td></td>
<td><br /><center><input name="save" type="button" value="Simpan" /></center></td>
</tr>
</tr>
The output that has text area is filled with bunch of codes. I attached the pic. How to fix it ?
note: I am using ckeditor.