// connect to database
	  $con = mysql_connect('localhost', 'root', '');
	  if (!$con) {
    	die('Could not connect: ' . mysql_error());
		echo 'Connected successfully';

	   $db_selected = mysql_select_db("template", $con);

	   if (!$db_selected)
  		die ("Can't use template : " . mysql_error());

	  // cek login
	  //undefined index: login
if (isset($_SESSION['login'])){
		echo "Anda tidak berhak mengakses halaman ini.";

	if (isset($_REQUEST['simpan'])){
		$kategori = mysql_real_escape_string($_REQUEST['kategori']);
		$id = $_REQUEST['id'];
		if (empty($id))
			$sqlstr = "INSERT INTO kategori_berita VALUES('".$kategori."')"  or die(mysql_error());
			$sqlstr = "UPDATE kategori_berita SET kategori = '".$kategori."' WHERE id =".$id;

These are the errors:

Connected successfully
Notice: Undefined index: kategori in C:\xampp\htdocs\php_template2\category_manager.php on line 97
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=
Notice: Undefined variable: id in C:\xampp\htdocs\php_templa' at line 1

Line 97: $kategori = mysql_real_escape_string($_REQUEST);

What's wrong with these errors: I am trying to save information and would like to see it
in table, yet the error appears and the saved information does not appears on the table.

I think problem is in the page which is calling this page and not on this page.
Check the spelling of your form elements in previous form.

Be a part of the DaniWeb community

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