Jump to content

php active tab 'active in' displaying issue


Go to solution Solved by dgnzcn,

Recommended Posts

Hi to everyone!

i write bootstrap dynamic tabs from mysql. But there was problem displaying to active tab's content if i refresh page. active tab content not displaying. but it is showing if i clicked to tabs.

 

i checked <li class="active"> is ok, but <div class="tab-pane fade ? ?"> active in is missing, and then tab content not displaying.

 

How can i fix issue?

Thanks.

 


?php
if($_GET['link']){
$link = $_GET['link'];

}
echo '<div class="row">';
echo '<div class="col-lg-12">';
echo '<ul id="myTab" class="nav nav-tabs nav-justified">';


$sorgula = "select * from tablar WHERE link = '$link' ORDER BY sira ASC";
$liste = mysqli_query($baglan, $sorgula);
while ($sonuc = mysqli_fetch_assoc($liste)) {
$Tabid = $sonuc['id'];
$ikon = $sonuc['ikon'];
$isim = $sonuc['isim'];
$kisa_aciklama = $sonuc['kisa_aciklama'];
$sira1[] = $sonuc['sira']; // $sira1[] değişkenine dönen tüm veriyi dizi olarak aktarır
$enkucuksira = min($sira1);
$enbuyuksira = max($sira1);

if ($enkucuksira != $enbuyuksira)
{?>

<li class=""><a href="#<?php echo $Tabid;?>" data-toggle="tab"><i class="fa <?php echo $ikon;?>"></i> <?php echo $isim;?></a></li>

<?php }else{?>

<li class="active"><a href="#<?php echo $Tabid;?>" data-toggle="tab"><i class="fa <?php echo $ikon;?>"></i> <?php echo $isim;?></a></li>

<?php }};?>

</ul>

<div id="myTabContent" class="tab-content">
<?php
$sorgula = "select * from tablar WHERE link = '$link' ORDER BY sira ASC";
$liste = mysqli_query($baglan, $sorgula);
while ($sonuc = mysqli_fetch_assoc($liste)) {
$Tabid = $sonuc['id'];
$ikon = $sonuc['ikon'];
$isim = $sonuc['isim'];
$kisa_aciklama = $sonuc['kisa_aciklama'];
$sira1[] = $sonuc['sira']; // $sira1[] değişkenine dönen tüm veriyi dizi olarak aktarır
$enkucuksira = min($sira1);
$enbuyuksira = max($sira1);
if ($enkucuksira != $enbuyuksira)
{?>
<div class="tab-pane fade" id="<?php echo $Tabid;?>">
<h4> <?php echo $isim;?></h4>
<p><?php echo $kisa_aciklama = html_entity_decode($kisa_aciklama, ENT_QUOTES, "utf-8");?></p>
</div>

<?php }else{?>

<div class="tab-pane fade active in" id="<?php echo $Tabid;?>">
<h4><?php echo $isim;?></h4>
<p><?php echo $kisa_aciklama = html_entity_decode($kisa_aciklama, ENT_QUOTES, "utf-8");?></p>
</div>
<?php }};?>
<hr>
</div>

</div>
</div>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.