Results 1 to 2 of 2

Thread: Question

  1. #1
    Join Date
    Dec 2003
    Location
    BelgiŽ
    Posts
    1

    Question Unanswered: Question

    Hello i'm new to this board and also new to php and i have a question.
    Here's the code i'm currently using :

    <?
    switch(strtolower($_GET['page']))
    {
    case "downloads":
    switch(strtolower($_GET['sub'])) {
    case "javascript": $page="downloads/java.php"; break;
    case "php": $page="downloads/php.php"; break;
    case "editors": $page="downloads/editors.php"; break;
    case "templates": $page="downloads/templates.php"; break;
    case "": $page="downloads/index.php";break;
    }
    break;

    default: $page="pages/news.html";break;
    }

    include($page);
    ?>

    My question is, how can i add another case so the link will look like this 'index.php?page=downloads&sub=javascript&fid=001'. I first thought of a case in a case but that didnt worked to well...If its possible could someone post an example of the code i need because i already said, i'm new to php.
    Regards, JoŽl.

  2. #2
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    PHP Code:
    <?
    switch(strtolower($_GET['page']))
    {
        case 
    "downloads"
        switch(
    strtolower($_GET['sub'])) { 
            case 
    "javascript"$page="downloads/java.php"; break; 
            case 
    "php"$page="downloads/php.php"; break; 
            case 
    "editors"$page="downloads/editors.php"; break; 
            case 
    "templates"$page="downloads/templates.php"; break; 
            case 
    ""$page="downloads/index.php";break;
        } break;

        default: 
    $page="pages/news.html";break;
    }

    if (isset(
    $_GET['fid'])){
        
    $fid=$_GET['fid'];
    }else{
        
    //default value if not set...
        
    $fid=-1;
    }

    include(
    $page);
    ?>
    Don't you want to use require rather than include?

    Oh yeah, please encase your code in [ php ] code here [ / php ] tags...

Posting Permissions

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