0

input_berita_static.php

$id = isset($_POST['id']) ? $_POST['id'] : '';  
	$confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';  
	$kategori = isset($_POST['kategori']) ? $_POST['kategori'] : ''; 
	$isiBerita = isset($_POST['isiBerita']) ? $_POST['isiBerita'] : '';
	$judul = isset($_POST['judul']) ? $_POST['judul'] : ''; 
	$page = isset($_POST['page']) ? $_POST['page'] : '';
	
	//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'];
		$judul = $data['judul'];
		$isiBerita = $data['isi_berita'];
	}
	
	//Simpan berita dan konfirmasi kepada subscriber
	if (isset($_REQUEST['ok'])){
		$page = $_REQUEST['page'];
		$judul = $_REQUEST['judul'];
		$news = $_REQUEST['news'];
		if (empty($_REQUEST['id']))
			$sqlstr = "INSERT INTO static_page(page, judul, isi_berita)VALUES('".$page."','".$judul."','".$news."')";
		else
			$sqlstr = "UPDATE berita 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="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; ?>"/>
			<table>
				<tr>
                    <td>Page</td>				
					<td><input size="50px" type="text" name="judul" 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 $isiBerita;?></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>
    
    
<?php //include('includes\footer.php'); ?>
    
    
<p>&nbsp;</p>
</body>
</html>

Notice: Undefined index: page in C:\xampp\htdocs\php_template2\input_berita_static.php on line 112
Unknown column 'page' in 'field list'

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by OmniX
0

Line 112 is:

$page = $_REQUEST['page'];

Yes, I do have a column name page in my static_page table.

Here is the column name: id page judul isi_berita

0

You are asking for a form post variable $_REQUEST nothing to do with a column in the static_page.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.