$kategori = isset($_POST['kategori']) ? $_POST['kategori'] : '';
//Hapus berita // undefined index: mode
if (!empty($_REQUEST['id']) && !empty($_REQUEST['mode'])){
if ($_REQUEST['mode'] == "delete"){
$id = $_REQUEST['id'];
$result = mysql_query("DELETE FROM berita WHERE id =".$id) or die(mysql_error());
$confirmation = ($result) ? "Data Telah terhapus." : "Gagal menghapus data.";
}
}
?>
<div align="center">
<div style="width:700px;text-align:left;padding-top:25px;">
<form method="get" action="<?php $_SERVER['PHP_SELF'] ?>">
<?php
//LOAD KATEGORI
$result = mysql_query("SELECT * FROM kategori_berita ORDER BY kategori ASC") or die(mysql_error());
?>
Pilih Kategori Terlebih dahulu <select name="kategori" onchange="submit();">
<?php
if (empty($_REQUEST['kategori'])) echo '<option value="" selected="selected">--Kategori--</option>';
while ($data=mysql_fetch_array($result)){
?><option <?php if ($_REQUEST['kategori'] == $data['id']) echo 'selected="selected"' ?> value="<?php echo $data['id']; ?>"><?php echo $data['kategori']; ?></option>
<?php
}
?>
</select><br/>
<a class="topLink" href="input_berita.php?kategori=<?php echo $_REQUEST['kategori']; ?>">Berita Baru >></a>
Pilih Kategori Terlebih dahulu (Translate: choose category)
--Kategori--
Notice: Undefined index: kategori in C:\xampp\htdocs\php_template2\news_manager.php on line 99 value="0">Action
Notice: Undefined index: kategori in C:\xampp\htdocs\php_template2\news_manager.php on line 99 value="1001">News
Notice: Undefined index: kategori in C:\xampp\htdocs\php_template2\news_manager.php on line 99 value="1002">Technology
Berita Baru >> (Translate: New News >>)
There are several notices when I run category, with few errors. How to fix the errors? I thought I already define category.
Thanks before.