Sub Cat List get vanish when click on a sub cat name

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 08, 2017 6:36 am

Wed Nov 08, 2017 6:47 am

Hi Guys, if anybody there to help me out in the issue below please:

I am learning PHP/PDO via project in youtube. by learning project I have created code below which is all fine but as soon as I click on a sub category, it shows products into center column but sub category list get vanish, I don't know what mistake I have done, I tried everything to redirect it to its own location i.e. into the left column but remain unsuccessful. it will be appreciated if someone help me in resolving the issue. code is here below:

function for sub cat list:
function list_all_subcat(){
$subcat_list=$conn->prepare("select * from sub_cat where cat_id='$cat_id'");
$subcat_list->setFetchMode(PDO:: FETCH_ASSOC);

echo "<li><a href='cat-detail.php?subcat_id=".$row_subcat_list['sub_cat_id']."'>".$row_subcat_list['sub_cat_name']."</a></li>";

function called into left column:
div id="bodyleft">
<div id="leftup">
<?php echo list_all_cat(); ?>
<div id="leftdown">
<h2>Sub Categories</h2>
<?php echo list_all_subcat(); ?>
cat-detail.php cpntains below code in body:

<div id="bodycontainer">
bodycenter contains below code in body:
<ul><?php echo cat_detail();?></ul><br clear='all'> //this will show details into center
<ul><?php echo subcat_detail();?></ul><br clear='all'>

Everything is working fine When I click on a Category in left column up, category list remain there and shows the related Sub Category which is OK

But when I click on a Sub Category into sub cat List then everything works fine except sub cat list which go went gone and I again need to click on category.

I remain failed to resolve this issue if anybody can help in this I will be thankful to him/her please.

Post Reply