Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    15

    Unanswered: PHP Dynamic pages

    Hi I am looking for help I cannot seem to get this codde to work.
    <?php
    switch $_GET["ni"]
    {
    default:
    include('home.php');
    break; case "home":
    include('home.php');
    break; case "contact":
    Include('contact.php');
    break; case "about":
    Include('about.php');
    break; case "portfolio":
    Include('portfolio.php');
    break; case "services":
    Include('services.php');
    break; case "cv":
    Include('cv.php');
    break; case "pics":
    Include('pics.php');
    break; case "poems":
    Include('poems.php');
    break; case "wrkxp":
    Include('wrkxp.php');
    break; case "diary":
    Include('diary.php');
    }
    ?>
    I want it so it opens in a table called content andall the link are ?page=home

  2. #2
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    PHP Code:
    <?php
    switch strtolower($_GET["page"]){
        case 
    "contact":    include('contact.php');    break;
        case 
    "about":    include('about.php');    break;
        case 
    "portfolio":    include('portfolio.php');    break;
        case 
    "services":    include('services.php');    break;
        case 
    "cv":        include('cv.php');        break;
        case 
    "pics":        include('pics.php');        break;
        case 
    "poems":    include('poems.php');    break;
        case 
    "wrkxp":    include('wrkxp.php');    break;
        case 
    "diary":    include('diary.php');    break;

        
    //do the default action
        
    default:        include('home.php');    break;
    }
    ?>
    note you had the $_GET["ni"], it should be $_GET["page"]. Also I put srtolower round it as you may some how get an upper case in there somewhere...

    try formatting it better and using the [ php ] [ / php ] tags please, also what exactly goes wrong?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •