Page 1 of 1

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

Posted: Fri Apr 25, 2008 3:23 pm
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>

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

Posted: Fri Apr 25, 2008 6:21 pm
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>

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

Posted: Sun Apr 27, 2008 11:23 pm
by Vinnie
Thanks Dave !

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

:drunk: :drunk: :drunk: