//Simpan berita dan konfirmasi kepada subscriber
if (isset($_REQUEST['ok'])){
	$judul = $_REQUEST['judul'];
	$news = $_REQUEST['news'];
	$idKategori = $_REQUEST['kategori'];
	$tanggal = date('Y-m-d');
if (empty($_REQUEST['id']))
	$sqlstr = "INSERT INTO berita(id_kategori, judul, isi_berita, tanggal)VALUES(".$idKategori.",'".$judul."','".$news."','".$tanggal."')";
	$sqlstr = "UPDATE berita SET 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="ckeditor/ckeditor.js"></script>
<link href="ckeditor/content.css" rel="stylesheet" type="text/css"/>
<?php echo $confirmation;?>
<form method="post" action="<?php $_SERVER['PHP_SELF']?>">
	<input type="hidden" name="id" value="<?php echo $id; ?>"/>
	<input type="hidden" name="kategori" value="<?php echo $_REQUEST['kategori']; ?>"/>
				<td><input size="50px" type="text" name="judul" value="<?php echo $judul; ?>"/></td>
				<td valign="top">Isi berita</td>			
					<textarea cols="60" rows="10" id="news" name="news"><?php echo $isiBerita;?></textarea>
					<script type="text/javascript">
					var editor = CKEDITOR.replace('news');
					</script>					</td>
			<td><input type="submit" name="ok" value="Simpan"/></td>

I am trying to input text messages with pictures with CKEditor. When I insert the picture at first in CKEditor, it works perfectly, yet later after I press "Simpan" (translate: save) button, the picture changes to a box with a x checked mark.

Why is it? I also, unable to see the picture in the front end / front page.

Recommended Answers

All 2 Replies

Member Avatar

Sounds as if the path-to-file is wrong. As a quick fix, try using an absolute path with the image (/....). I'm assuming that your editor page is in a different directory to the page in which you want the image to appear.

After I press the save button the image turn to a box with an x mark in CKEditor. Then I place the cursor on the image in CKEditor and press the image picture. Then on the URL form box I see another file name written with the wrong path: ex. Imagesews.gif

My editor page is on php_template2\input_berita.php whereas my image file in on php_template2\Images\news.gif (many other images are in here).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.