来自php的不必要的通知[重复]

recently i just configure my script with common script for entry data while im trying to submit the data , the data is successful to submit . but there is something notice that bothering me , they say Notice: Undefined index: type in D:\xampp\htdocs\project\submit.php on line 7

and the line is

<?php
include 'includes/config.php';


if($_SERVER["REQUEST_METHOD"] == "POST")
{
$type=addslashes($_POST['type']); // this is line 7
$nama_barang=addslashes($_POST['nama_barang']);
$kategori=addslashes($_POST['kategori']);
$deskripsi=addslashes($_POST['deskripsi']);

im using xampp v.3.2.1 , it is possible the notice is from the xampp ? thanks you guys im so glad for your answer :))

</div>

The notice mentions that your $_POST array has no index type. So you should check for it before you try to access it:

$type = ""; //you could set a default here
if(array_key_exists("type", $_POST))
    $type = addslashes($_POST['type']);

type (and other $_POST members) may not always be set so you should try and code to detect that.

e.g:

$type = (isset($_POST['type'])) ? addslashes($_POST['type']) : false;