product_category.php
// SIMPAN
if (isset($_REQUEST['simpan']))
{
$kategori = mysql_real_escape_string($_REQUEST['kategori']);
$id = isset($_POST['id']) ? $_POST['id'] : '';
$id = $_REQUEST['id'];
if(empty($id))
$result = mysql_query("INSERT INTO kategori (nama_kategori) VALUE ('".$kategori."')") or die(mysql_error());
else
$result = mysql_query("UPDATE kategori (nama_kategori) SET kategori = '".$kategori."') WHERE id=".$id) or die(mysql_error());
$confirmation = $result ? "Data telah tersimpan." : "Gagal menyimpan data.";
$kategori = "";
$id = "";
}
When I execute the above code, I get this error:
Notice: Undefined index: id in C:\xampp\htdocs\Masterlink\cgoods\product_category.php on line 65 (line 8 as posted)
Why is it ? I thought I already defined $id