Notice: Undefined index: action in /home/nabilu/c/blogger.com/user/htdocs/formulir.php on line 19.
pernah dapat pesan spt di atas?
pada 19 nya berisi kode: if($_POST[‘action’] == “send”){ dst….
untuk jalan keluarnya, coba gunakan salah satu metode berikut:
pertama:
Check if $_POST[‘action’] is set before using it. For example:
if (!isset($_POST[‘action’]))
{
//If not isset -> set with dumy value
$_POST[‘action’] = “undefine”;
}
kedua:
Notice warnings could be suppressed by changing the error_reporting variable in your PHP.ini. error_reporting could be set to show all errors except those for notices and coding standards warnings: error_reporting = E_ALL & ~E_NOTICE
The same is accomplished by adding the following line in your php page:
<?php error_reporting (E_ALL ^ E_NOTICE); ?>
semoga tidak buat pusing, heee.. heee
Tambahan:
if($_GET[‘pg’]==1)
menjadi
if(isset($_GET[‘pg’])==1)
atau
$warn = $_GET[‘warn’];
menjadi
if(isset($_GET[‘warn’])) { $warn = $_GET[‘warn’]; } else { $warn = “”; }
atau
if($_GET[‘pg’]==1)
ditambahakan tanda @ di depannya menjadi
if(@$_GET[‘pg’]==1)
atau
tambahkan ~E_NOTICE
dengan cara ini semua pesan error akan ditampilkan kecuali error notice. Cara pakainya gampang, letakan code ini dibagian paling atas :
error_reporting (E_ALL & ~E_NOTICE); |