PDA

View Full Version : Error PHP SWITCH CASE


ardi258
11-27-2013, 02:16 PM
guys help for this script :

opsi not function, I don't know where the mistake.

<?php
if($status=="Kabiro" && $opsi=="")
{
include"home/home_kabiro.php";
}
else if($status=="Staff" && $opsi=="")
{
include"home/home_staff.php";
}
?>

<?php
$opsi = ("Number");
switch($opsi){
case '01a' :
$include = ("pengguna.php");
break;
case '02a':
$include = ("dokumen.php");
break;
case '03a':
$include = ("pegawai.php");
break;
case '04a':
$include = ("log.php");
break;
case '05a':
$include = ("kabiro_dokumen.php");
break;
case '06a':
$include = ("disposisi_keluar.php");
break;
case '07a':
$include = ("disposisi.php");
break;
case '08a':
$include = ("disposisi_masuk.php");
break;
case '09a':
$include = ("profile.php");
break;
case '10a':
$include = ("laporan.php");
break;
case '11a':
$include = ("laporan_keluar.php");
break;
case '12a':
$include = ("laporan_masuk.php");
break;
}
?>

edbr
11-28-2013, 12:51 AM
so what is happening? not sure what you are trying to do here. you declare $opsi as " Number" then the switch looks at other options . what if you set a default?