how to solve this problem

A

Anonymous

Guest
Code:
<html>
<head>
<title>UPT - Forme_lende_per_drejtim</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body topmargin="0" background="sfondi.gif">
<? 
require_once("dbvars.php");
require_once("dbconnect.php");
require("lendet.php");
require("listodrejtimet.php");
?>
<? 	if (isset($_POST["Passwordadmin"]) )
  { $Passwordadmin = $_POST["Passwordadmin"];
    $passkod = md5($Passwordadmin); 
  } else 
  if (isset($_GET["Passwordadmin"]) )
  { $Passwordadmin = $_GET["Passwordadmin"];
    $passkod = $Passwordadmin;
  } else { $passkod=''; }
  if ($passkod!='')
  {
	$query = "select * from login where Nr = '1'";
    $result = mysql_query($query);
	$passok = mysql_result($result, 0, "Password");
	if ($passkod == $passok)
	{ shfaq_forme(); } else {echo "<p> </p><p> </p><p> </p> <center> <strong> <li> <strong> Fjalëkalim i gabuar! </strong> </li> </strong> </center> <p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>"; }
  }
  else { echo "<p> </p><p> </p><p> </p> <center> <li> <strong> Ju nuk keni të drejta për të hyrë në këtë faqe! </strong> </li> </center> <p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>"; }
  
  function shfaq_forme()
{
	if (isset($_POST["Passwordadmin"]) )
  { $Passwordadmin = $_POST["Passwordadmin"];
    $passkod = md5($Passwordadmin); 
  } else 
  if (isset($_GET["Passwordadmin"]) )
  { $Passwordadmin = $_GET["Passwordadmin"];
    $passkod = $Passwordadmin;
  }
?>
<form name="form1" method="post" action="shto_lende_per_drejtim.php?Passwordadmin=<? echo ($Passwordadmin);?>">
  <p align="center"> </p>
  <p align="center"> </p>
  <p align="center"><font color="#00009D" size="2" face="Arial, Helvetica, sans-serif"><strong>Zgjidhni 
    Drejtimin për të cilin do të specifikoni lëndët:</strong></font> 
    <select name="Drejtimi">
      <option></option>
      <? listodrejtimet(); ?>
    </select>
  </p>
  <table width="35%" border="1" align="center" bordercolor="#333399">
    <tr bgcolor="#5151A2"> 
      <td width="30%"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Emri 
        Lëndës</font></strong></td>
      <td width="13%"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong>Viti 
        Zhvillimit</strong></font></td>
      <td width="13%"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Sezoni</font></strong></td>
    </tr>
    <tr valign="middle" bgcolor="#DFDFFF"> 
      <td height="32"> 
        <div align="center"> 
          <select name="Em1">
            <option></option>
            <? listolendet(); ?>
          </select>
        </div></td>
      <td> 
        <div align="center"> 
          <select name="Vit1">
            <option></option>
            <option value="Viti I">Viti I</option>
            <option value="Viti II">Viti II</option>
            <option value="Viti III">Viti III</option>
            <option value="Viti IV">Viti IV</option>
            <option value="Viti V">Viti V</option>
          </select>
        </div></td>
      <td> 
        <div align="center"> 
          <select name="Sez1">
            <option></option>
            <option value ="Sezoni I">Sezoni I</option>
            <option value ="Sezoni II">Sezoni II</option>
         </body>
</htm>
wat i want is that in the momnt that i choose (informatic or eletronic from drejtimi ) iwant to list all the materia of the specific choise . i mean if i choose informatic i want to display in the materia(lendet) only the materia informamatic not even for electronic .
the function that i have used r here:
Code:
<?
 
function listolendet()
{
 global $HTTP_POST_VARS;

/* Listohen lendet */
 $query_lendet = "SELECT ID_Lenda, Emri, Nr_Lek, Nr_Sem, Nr_Lab, Nr_Projekt, Nr_Det_Kursi, Provim from lendet WHERE PrindID is NULL ORDER BY Emri";
 $result_lendet = mysql_query($query_lendet) or die ("Error in query:$query_lendet. " . mysql_error());	
 
 while ($row_lendet = mysql_fetch_array($result_lendet)) {
   		 if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row_lendet["ID_Lenda"])
						{
						   ?><option selected value="<? echo $row_lendet["ID_Lenda"]; ?>"><? echo $row_lendet["Emri"];?> </option>
						   <?
					  } else {
						  ?> <option value="<? echo $row_lendet["ID_Lenda"]; ?>"> <?  echo $row_lendet["Emri"];?></option>
					   <?		
						}
						
					afisho($row_lendet["Emri"], 1);
			}
}//mbaron funksioni listolendet()


function afisho($PrindID, $niveli)
{
	 global $HTTP_POST_VARS;
	 
	 $query_emer = "SELECT ID_Lenda, Emri from lendet WHERE PrindID='$PrindID' ORDER BY Emri";
 	 $result_emer = mysql_query($query_emer) or die ("Error in query:$query_emerlenda. " . mysql_error());
 
     while ($row = mysql_fetch_array($result_emer)) {
     		 if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row["ID_Lenda"])
						{
						   ?><option selected value="<? echo $row["ID_Lenda"]; ?>"><? echo $row["Emri"];?> </option>
						   <?
					  } else {
						   ?> <option value="<? echo $row["ID_Lenda"]; ?>"> <?  echo "   " .$row["Emri"];?></option>
					   		<?		
						}
					afisho($row["Emri"], 1);
			}
}
//mbaron funksioni afisho()
?>
the second one is:
Code:
<?
 
function listodrejtimet()
{
 global $HTTP_POST_VARS;

/* Listohen grupet */
 $query_drejtimet = "SELECT ID_Drejtimi, Emer, ID_Departament from drejtimet WHERE PrindID is NULL ORDER BY Emer";
 $result_drejtimet = mysql_query($query_drejtimet) or die ("Error in query:$query_drejtimet. " . mysql_error());	
 
 while ($row_drejtimet = mysql_fetch_array($result_drejtimet)) {
   		 if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row_drejtimet["ID_Drejtimi"])
						{
						   ?><option selected value="<? echo $row_drejtimet["ID_Drejtimi"]; ?>"><? echo $row_drejtimet["Emer"];?> </option>
						   <?
					  } else {
						  ?> <option value="<? echo $row_drejtimet["ID_Drejtimi"]; ?>"> <?  echo $row_drejtimet["Emer"];?></option>
					   <?		
						}
						
					afisho2($row_drejtimet["Emer"], 1);
			}
}//mbaron funksioni listogrupet()


function afisho2($PrindID, $niveli)
{
	 global $HTTP_POST_VARS;
	 
	 $query_emer = "SELECT ID_Drejtimi, Emer from drejtimet WHERE PrindID='$PrindID' ORDER BY Emer";
 	 $result_emer = mysql_query($query_emer) or die ("Error in query:$query_emerdrejtimi. " . mysql_error());
 
     while ($row = mysql_fetch_array($result_emer)) {
     		 if (isset ($HTTP_POST_VARS["PrindID"]) and $HTTP_POST_VARS['PrindID']==$row["ID_Drejtimi"])
						{
						   ?><option selected value="<? echo $row["ID_Drejtimi"]; ?>"><? echo $row["Emer"];?> </option>
						   <?
					  } else {
						   ?> <option value="<? echo $row["ID_Drejtimi"]; ?>"> <?  echo "   " .$row["Emer"];?></option>
					   		<?		
						}
					afisho2($row["Emer"], 1);
			}
}
//mbaron funksioni afisho()
?>
please help me :help:

Edited by gesf: Please use code tags next time!
 
Back
Top