<?php
session_start();
include_once('dbconnect.php');
$query="select * from category_master where project_id=1 and parent_category_id=0";
$result=mysql_query($query);
?>
<html>
<head>
<title>Manage Projects</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="Style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function reloadfrm()
{
document.disp.method="post"
document.disp.action="<?php echo $_SERVER['PHP_SELF']; ?>"
document.disp.submit()
}
<?php
function myTree ($pid,$cid)
{
$item_query=mysql_query ( "select from category_master where project_id=$pid and parent_category_id=$cid");
while($row=mysql_fetch_array( $item_query ))
{
?>
<br><br><img src="Images/folder.gif"> <a href="<?php echo $SERVER['PHP_SELF']; ?>?catid=<?php echo $row['category_id'];?>&catname=<?php echo $row['category_name'];?>" class="links" "><?php echo $row['category_name'];?></a><br>
<?php
if(isset($GET['catid']))
{
$catid=$GET['catid'];
unset($GET['catid']);
$query="select from category_master where parent_category_id=$catid and project_id=$pid";
$result=mysql_query($query);
while($r=mysql_fetch_array($result))
{?>
<br><br><img src="Images/folder.gif"> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?catid=<?php echo $r['category_id'];?>&catname=<?php echo $r['category_name'];?>" class="links" "><?php echo $r['category_name'];?></a><br>
<?php }
}
}
} ?>
</script>
</head>
<body class="pagebgcolour">
<form method="post" name="disp">
<?php
echo $_SESSION['path'];
myTree("33","0");
//myTree("33","9");
?>
<input type="hidden" name="subcat">
</form>
</body>
</html>
This is the code fragment I am currently working on... we have to browse down the categories onclick... and when I click on the sub category the sub sub category is shown but the prev level sub category is not shown. Please help me with this..
thanks a lot,
Tushar