+ Reply to Thread
Results 1 to 5 of 5

Thread: code help

  1. #1
    coolv1994 is offline x10 Elder coolv1994 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    506

    Question code help

    does anyone know the code in php to stay on the same page but switch content
    like index.php?id=page1 and that shows page 1 and index.php?id=page2 shows page 2

  2. #2
    Christopher's Avatar
    Christopher is offline Retired Christopher is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    USA
    Posts
    7,330

    Re: code help

    PHP Code:
    <?php 

    if (isset($_GET['id'])) $PAGE $_GET['id'];

    else 
    $ID 'home'

    switch (
    $ID) {
    //1- index
    case 'home'
    include (
    'home.tpl.php'); 
    break;

    //2- something else
    case 'home'
    include (
    'home.tpl.php'); 
    break;

    default:
    echo 
    "<p align=center>Error 404!<br><br>The page you request doesn't exist!</p>"
    break;


    ?>
    Found that on some website a long time ago. Can't remember where though.
    Last edited by Christopher; 11-22-2007 at 10:20 PM.

  3. #3
    coolv1994 is offline x10 Elder coolv1994 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    506

    Re: code help

    thanks =)
    Edit:
    the code didnt work
    when i load the pag it says could not load directory in home/...
    Last edited by coolv1994; 11-22-2007 at 11:15 PM. Reason: Automerged Doublepost

  4. #4
    nabil's Avatar
    nabil is offline x10Hosting Member nabil is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Mauritius
    Posts
    39

    Re: code help

    Hello,
    You can also use the following :
    Code:
    <?php 
    if(!$_GET['id']) include('home.php');
    if($_GET['id'] == 1) include('page1.php');
    if($_GET['id'] == 2) include('page2.php');
    ?>
    NaBiL
    "It's choice not chance that determines your destiny."

  5. #5
    coolv1994 is offline x10 Elder coolv1994 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    506

    Re: code help

    omg thx tht 1 really works

+ Reply to Thread

Similar Threads

  1. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM
  2. New x10 ad code
    By yahia in forum Feedback and Suggestions
    Replies: 23
    Last Post: 01-02-2007, 12:56 PM
  3. Ad Code Question
    By reiterb in forum Free Hosting
    Replies: 1
    Last Post: 08-18-2005, 09:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers