Php Menu Tab (NOT highlighted when link has "?" in it)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Vinnie
Forum Newbie
Posts: 2
Joined: Fri Apr 25, 2008 2:55 pm

Php Menu Tab (NOT highlighted when link has "?" in it)

Post by Vinnie »

I found these codes in this website
http://www.weberdev.com/get_example-4584.html

If web Links is dynamic, it doesn't work!
Can anyone help to fix this please! i don't know much PHP, just a newbie

These links are ok:
normal web links works !

Code: Select all

<li><a href="PHPtabZ.php?tab=1">Tab 2</a></li>

Code: Select all

<li><a href="http://www.google.com?tab=1">Tab 2</a></li>
If links have "?" in it.It's NOT highlighted when it is clicked:
Dynamic web links don't work!

Code: Select all

<li><a href="http://testcom/index.php?main_page=products_all?tab=1">Tab 2</a></li>

Code: Select all

<li><a href="http://test.com/index.php?main_page=site_map?tab=1">Tab 2</a></li>



Code: Select all

<?php
if (isset($_REQUEST['tab'])) {
        $tab = $_REQUEST['tab'];
    } else {
        $tab = 0;
    }
?> 
 
 

Code: Select all

   <?php
switch ($tab) {
    case 1:     //Manage User Tab1
?>
                    <ul class="tabZ">
                        <li><a href="PHPtabZ.php?tab=0">Tab1</a></li>
                        <li class="selected"><a href="PHPtabZ.php?tab=1">Tab 2</a></li>
                        <li><a href="PHPtabZ.php?tab=2">Tab 3</a></li>
                    </ul>
     
<?php
    break;
    case 2:     // Manage User Tab2
   
?>   
                    <ul class="tabZ">
                        <li><a href="PHPtabZ.php?tab=0">Tab1</a></li>
                        <li><a href="PHPtabZ.php?tab=1">Tab 2</a></li>
                        <li class="selected"><a href="PHPtabZ.php?tab=2">Tab 3</a></li>
                    </ul>
   
<?php
    break;
    default:     // Manage User TabDefault
?>                   
                    <ul class="tabZ">
                        <li class="selected"><a href="PHPtabZ.php?tab=0">Tab1</a></li>
                        <li><a href="PHPtabZ.php?tab=1">Tab 2</a></li>
                        <li><a href="PHPtabZ.php?tab=2">Tab 3</a></li>
                    </ul>
                       
<?php
break;
}
?>
                   
</body>
</html>
User avatar
DaveTheAve
Forum Contributor
Posts: 385
Joined: Tue Oct 03, 2006 2:25 pm
Location: 127.0.0.1
Contact:

Re: Php Menu Tab (NOT highlighted when link has "?" in it)

Post by DaveTheAve »

Vinnie wrote: If links have "?" in it.It's NOT highlighted when it is clicked:
Dynamic web links don't work!

Code: Select all

<li><a href="http://testcom/index.php?main_page=products_all?tab=1">Tab 2</a></li>

Code: Select all

<li><a href="http://test.com/index.php?main_page=site_map?tab=1">Tab 2</a></li>
First off your links are incorrect; correct these and post your results.

Fixes: (the secound variable is denoted with a & not a ?)

Code: Select all

<li><a href="http://testcom/index.php?main_page=products_all&tab=1">Tab 2</a></li>

Code: Select all

<li><a href="http://test.com/index.php?main_page=site_map&tab=1">Tab 2</a></li>
Vinnie
Forum Newbie
Posts: 2
Joined: Fri Apr 25, 2008 2:55 pm

Re: Php Menu Tab (NOT highlighted when link has "?" in it)

Post by Vinnie »

Thanks Dave !

It works now! i changed "?tab=1" to "&tab=1" as you said. Thanks.

:drunk: :drunk: :drunk:
Post Reply