RonKevinT.Manuela 0 Junior Poster in Training

This code works fine except for the fact that it doesn't display what I queried on posts tabs...only this part of the code with an id=pages displays my query..i checked if I have a wrong query but it works when I change the include("../includes/mainpanelpage.php") to include("../includes/mainpanelpost.php")...meaning only the code inside the pages tab is able to read my includes where my queries are found..

<?php  require_once('../includes/config.php');
  if( !$user->is_logged_in() ){ header('Location: /sics/users/login.php'); }?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin/Faculty Panel</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../css/sics.css">
<style type="text/css">
 #usernav .drop {
  color: black;
 }
 </style>  
</head>
<body>
 <div id="header" class="page-container">
 <!-- TOP NAVBAR -->
 <?php include("../includes/topnavbar.php");?>
 <!-- End of Top Navbar-->
<div id="content-1" class="container">
</br>
</br>
</br>
<!-- Nav tabs -->
<ul class="nav nav-tabs admin-only" role="tablist">
 <?php include("../includes/adminfacultynavbar.php");?>
</ul>
<!-- Tab panes -->
<div class="tab-content">
  <!-- Pages -->
  <div class="tab-pane active" id="pages">
    <table class="table table-hover">
      <thead>
        <tr>
          <th>#</th>
          <th>Page</th>
          <th>Options</th>
        </tr>
      </thead>
     <?php include("../includes/MainPanelPage.php");?>
    </table>
  </div>
  <!-- Pages end -->
  <!-- Posts -->
  <div class="tab-pane" id="posts">
    <table class="table table-hover">
      <thead>
        <tr>
          <th>#</th>
          <th>Titles</th>
          <th>Options</th>
          <th><a href="#add-post" data-toggle="modal" data-         target="#addpost">AddPost</a></th>
        </tr>
      </thead>
     <?php ('../includes/MainPanelPost.php');?>
    </table>
  </div>
  <!-- Posts end -->

Dani AI

Generated

Short answer for : the problem is on the server side, not the Bootstrap tabs. PHP runs when the page is generated, so both panes are evaluated regardless of which tab is active in the browser. In the posted markup the PHP block inside the Posts pane never actually includes the posts file (it contains a PHP expression instead of an include/require call), so nothing from that file is injected into the table. That explains why placing the posts include inside the Pages pane works — the posts code itself is fine, it just wasn’t being executed where you expected.

Immediate fixes and quick checks:

  • Replace the broken PHP statement in the Posts pane with a proper include/require and use a safe path. Example:

    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    
    require_once __DIR__ . '/../includes/MainPanelPost.php';
  • Verify case-sensitivity (Linux servers distinguish file names) and file permissions.

  • Confirm the included file only prints table rows (tr/td) so the outer table markup stays valid.

  • Ensure the nav link’s href matches the pane id and there are no duplicate ids or JavaScript errors stopping tab switching.

  • Look at the page source and server error log if nothing appears — suppressed PHP errors commonly hide the real cause.

Relevant docs: PHP include/require and Bootstrap tabs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.