Variables Anchor Text

Discussion in 'PHP' started by advancedfuture, Mar 12, 2007.

  1. #1
    ok... update....

    my main page im trying to inlude dymanic content based on the variable in the anchor text... the main page I call the switch like this:
    index.php
    
    <?php
    $page = $_GET['page'];
    switch ($page) { 
    	case ($page != ""): 
    		include('$page'); 
    		break; 
    	default: 
    		include('main_1.php'); 
    } 
    ?> 
    Code (markup):
    now the Anchor text is:

    <a class="navbar3" href="http://www.layoutgurus.com/index.php?page=layouts/anime.php">Anime</a>
    Code (markup):
    The problem is when I click the link... the page stays the same. It doesnt load the new page based on the $page variable value.
     
    advancedfuture, Mar 12, 2007 IP
  2. advancedfuture

    advancedfuture Banned

    Messages:
    481
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    basically I am just trying to call a page in the switch... and since I have about 250 pages. I dont want to have to make 250 case statements...
     
    advancedfuture, Mar 12, 2007 IP
  3. advancedfuture

    advancedfuture Banned

    Messages:
    481
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hah damn... sometimes i feel like i post on here just to post =(

    I solved my problem.. I guess with enough tinkering i will eventually always solve my problem...

    I ended up not using a case statement since the content will always be changing and i dont want 100000 different cases. I went with an if else and now it works great.

    
    <?php
    $page = $_GET['page'];
    urlencode($page);
    if($page > ""){
    	include($page);}
    Else{
    	include('main_1.php');
    } 
    ?> 
    Code (markup):
     
    advancedfuture, Mar 12, 2007 IP