Mohon bantuannya kalo untuk menampilkan data di menu list sesuai dengan menu yang dipilih kita,
contoh kode PHP dibawah :
saya memilih di menu kategori yang berisikan : infras,mi,pelaporan,pembayaran
*tiap kategori tersebut memiliki nama2 didalamnya (misalkan di infras:budi,joko)(mi:mawar,dian) dst.
nah jika kita memilih kategori tersebut akan otomatis muncul nama2nya sesuai kategori yang kita pilih.
bagaimana caranya, mohon pencerahannya, terima kasih :)
<?php
	
	error_reporting(0);
	session_start();
	include "Connect.php";
	
if(empty($_SESSION['username']) AND empty($_SESSION['password'])){
	echo"<center> Lakukan login !<br>";
	echo"<a href=index.php><b>Ulangi Lagi</b></a></center>";
	}
	else{
	$server ="localhost";
	$username ="root";
	$password ="";
	$database ="newproject_db";
	mysql_connect($server,$username,$password)or die("koneksi gagal");
	mysql_select_db($database)or die("Database tidak bisa dibuka");
	
	?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv=refresh content=30;url=http://localhost/tes/View.php>
<title>Untitled Document</title>

<style type="text/css">
<!--
.style1 {
	font-size: 26px;
	font-weight: bold;
	
}
.style2 {
	font-size: 14px;
	font-weight: bold;
}
body {
	background-image:url(Website_Background.png);
}
-->
</style>
</head>
<body>
<tr>
<td><marquee direction="right"><div align="left" class="style1"><b><font size="+3"><font class="style1"><?php

				echo date("d-M-Y");
				?></b></font></div></td></marquee></tr>

<table style="width:1000" align="center">
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    
  </tr>
    <table width="965" border="2" bordercolor="#0033FF">
      <tr>
        <td><form action="Masukin.php?pid=<?php echo $kode; ?>" method="post" enctype="multipart/form-data">
          <table width="700" align="center">
            <tr>
              <td><b>Operator Code</b></td>
              <td>:</td>
              <td><label for="op"></label>
              
              
                <?PHP 
				
$get_status = mysql_query("select kode_operator from operator");
?> 
                <select name="op" id="op" style="width:155px">
                  <option selected="selected"></option>
                                    <?php while($status = mysql_fetch_array($get_status)){ ?>
                  <option><?php echo $status['kode_operator']; ?></option>
                  <?php } ?>
                                
              </select></td>
              </tr>
            <tr>
              <td><b>Category Problem</b></td>
              <td>:</td>
              <td><label for="cat"></label>
             
           
              <?PHP 
			  
	
$get_problem = mysql_query("select distinct kategori from fls");
?>
              <select name="cat" id="cat"style="width:155px">
              <option selected="selected"></option>
                               <?php while($problem = mysql_fetch_array($get_problem)){ 
				?>
                <option><?php echo $problem['kategori']; ?></option>
                <?php } ?>    
              </select></td>
            </tr>
            <tr>
              <td><b>FLS</b></td>
              <td>:</td>
              <td> 
  
<?php		
 
	 
$get_status = mysql_query("select kode from fls");


?> 
                <select name="fls" id="fls"style="width:155px">
                  <option selected="selected"></option>
                  <?php while($status = mysql_fetch_array($get_status)){ ?>
                  <option>
                    <?php
		echo $status['kode']; ?>
                    </option>
                  <?php } ?>
                  </select></td>
              </tr>
                        
			 
            <tr>
              <td><b>Ticket</b></td>
              <td>:</td>
              <td><label for="tkt"></label>
                <input name="tkt" type="text" id="tkt" /></td>
              </tr>
            <tr align="center">
              <td colspan="3" bgcolor=""><input type="submit" value="Submit" />
                <input name="Reset" type="reset" value="Reset" />
                <input name="Batal" type="submit" id="Batal" value="Cancel" /></td>
              </tr>
            </table>
        </form></td>
      </tr>
    </table>
<?php     
include"FusionCharts/FC_Colors.php";
include"FusionCharts/FusionCharts_Gen.php";
include"FusionCharts/FusionCharts.php";
?>

<table width="left" border="1" bgcolor="#0033CC">
<tr>
<td>
<?php
echo"<div style='margin-left:0px;'><SCRIPT LANGUAGE='Javascript' SRC='FusionCharts/FusionCharts.js'></SCRIPT>";
	
	 $FC = new FusionCharts("Column3D","955","300"); 
	 $FC->setSWFPath("FusionCharts/");
	 
	 
	 $strParam="caption=Group Infrastruktur ; subcaption=; xAxisName=; yAxisName=; numberPrefix=; decimalPrecision=0";
	
	 $FC->setChartParams($strParam);
	 $qr=mysql_query("select* from fls where kategori='infra'"); 
	 while($fls=mysql_fetch_array($qr)){ 
	 $FC->addChartData("$fls[jumlah_tiket]","name=$fls[kode]");
	 
}	 	 

	$FC->renderChart();
echo"</div>";

?></td></tr>

<table border="1" bgcolor="#0033CC">
<tr>
<td>
<?php
echo"<div style='margin-left:0px;'><SCRIPT LANGUAGE='Javascript' SRC='FusionCharts/FusionCharts.js'></SCRIPT>";
	
	 $FC = new FusionCharts("Column3D","350","300"); 
	 $FC->setSWFPath("FusionCharts/");
	 
	 $strParam="caption=Group MI ; subcaption=; xAxisName=; yAxisName=; numberPrefix=; decimalPrecision=0";
	
	 $FC->setChartParams($strParam);
	 $qr=mysql_query("select* from fls where kategori='MI'"); 
	 while($fls=mysql_fetch_array($qr)){ 
	 $FC->addChartData("$fls[jumlah_tiket]","name=$fls[kode]");
	 	 	
}	 	 

	$FC->renderChart();
echo"</div>";
?>
</td>
<td>
<?php
	 $FC = new FusionCharts("Column3D","600","300"); 
	 $FC->setSWFPath("FusionCharts/");
	 
	 $strParam="caption=Group Pelaporan ; subcaption=; xAxisName=; yAxisName=; numberPrefix=; decimalPrecision=0";
	
	 $FC->setChartParams($strParam);
	 $qr=mysql_query("select* from fls where kategori='Pelaporan'"); 
	 while($fls=mysql_fetch_array($qr)){ 
	 $FC->addChartData("$fls[jumlah_tiket]","name=$fls[kode]");
}

	$FC->renderChart();
echo"</div>";
?></td>
</tr>

<table border="1" bgcolor="#0033CC">
<tr>
<td>
<?php
echo"<div style='margin-left:0px;'><SCRIPT LANGUAGE='Javascript' SRC='FusionCharts/FusionCharts.js'></SCRIPT>";
	
	 $FC = new FusionCharts("Column3D","550","300"); 
	 $FC->setSWFPath("FusionCharts/");
	 
	 $strParam="caption=Group Pembayaran ; subcaption=; xAxisName=; yAxisName=; numberPrefix=; decimalPrecision=0"; 
	
	 $FC->setChartParams($strParam);
	 $qr=mysql_query("select* from fls where kategori='Pembayaran'"); 
	 while($fls=mysql_fetch_array($qr)){ 
	 $FC->addChartData("$fls[jumlah_tiket]","name=$fls[kode]");
}	 	 

	$FC->renderChart();
echo"</div>";
?></td>
<td>
<?php
echo"<div style='margin-left:0px;'><SCRIPT LANGUAGE='Javascript' SRC='FusionCharts/FusionCharts.js'></SCRIPT>";
	
	 $FC = new FusionCharts("Column3D","450","300"); 
	 $FC->setSWFPath("FusionCharts/");
	 
	 $strParam="caption=Group Operator ; subcaption=; xAxisName=; yAxisName=; numberPrefix=; decimalPrecision=0"; 
	
	 $FC->setChartParams($strParam);
	 $qr=mysql_query("select* from operator where kategori='Operator'"); 
	 while($fls=mysql_fetch_array($qr)){ 
	 $FC->addChartData("$fls[jumlah_tiket]","name=$fls[kode_operator]");
}	 	 

	$FC->renderChart();
echo"</div>";
?></td>
</tr>
        <?php 
					if(isset($_REQUEST['jenis'])) {$jenis = $_REQUEST['jenis'];}
					if(isset($_REQUEST['search'])) {$search = $_REQUEST['search'];}
					else{$search="";}
					if($search == "")
					{
						$result = mysql_query("select * from fls ");
					}
					else
					{
						if($jenis == "Kode")
						{
							$result = mysql_query("select * from fls where kode='$search'");
						}
						else if($jenis == "Kategori")
						{
							$result = mysql_query("select * from fls where kategori='$search'");
						}
					}
					while($row = mysql_fetch_array($result)){
				?>
        
        <?php } ?>
    </table><?php
          $result = mysql_query("select * from operator");
		  while($row = mysql_fetch_array($result)){
		  ?>
        
    
      
         <?php } ?>

      </table>
    <p>&nbsp;</p></td>
  </tr>
   
  <tr>
    <td><table width="600" border="1" align="center">
      <tr>
        <td bgcolor="#999999" width="900">Data Operator</td>
        <td bgcolor="#999999"><table width="300" border="1">
          <tr>
            <td bgcolor="#999999" width="200"><strong>Total Tiket</strong></td>
            <?php
          $result = mysql_query("select distinct total_tiket from operator");
		  while($row = mysql_fetch_array($result)){
		  ?>
            <td bgcolor="#999999" width="200"><?php echo $row['total_tiket']; ?></td>
          </tr>
          <?php } ?>
        </table></td>
      </tr>
      <tr>
        <td bgcolor="#999999" width="300">Data FLS</td>
        <td bgcolor="#999999"><table width="300" border="1">
          <tr>
            <td bgcolor="#999999" width="200"><strong>Total Tiket</strong></td>
            <?php
          $result = mysql_query("select distinct total_tiket from fls");
		  while($row = mysql_fetch_array($result)){
		  ?>
            <td bgcolor="#999999" width="200"><?php echo $row['total_tiket']; ?></td>
          </tr>
          <?php } ?>
        </table></td>
      </tr>
      <tr>
        <td colspan="2" align="center" bgcolor="#999999"><strong>
         <?php
if ( $_SESSION [ 'username' ] == "admin" )
{
?>
<form method="post" name="hidden" action=<a><a href="NgilanginData.php">Reset Data</a></a></strong>
<?php
}
?></td>
        </tr>
        <td colspan="2" align="center" bgcolor="#999999"><strong><a href="logout.php">Logout</a></a></strong></td>
    </table>
      <p>&nbsp;</p>
      <strong><a href="NgilanginData.php"></a></strong><br/>
      <br/>
      <br/>
    <br/></td>
    
  </tr>
</table>
</body>
</html>
<?php
}
?>
<?php
}
?>


Silahkan login untuk menjawab!
0
Loading...
iqbal · Jun 15, 2013 · 0 Suka · 0 Tidak Suka
Mohon bantuuanya master php :)
0
Loading...
Ellyx Christian · Jun 20, 2013 · 0 Suka · 0 Tidak Suka
saya masih bingung dengan pertanyaannya, karena kodenya juga membingungkan, pertama dari mana katergori ini didapat, dan nama namanya diambil dimana, dan mau ditampilkan dimana?