How to dispaly a webpage?

Discussion in 'PHP' started by prabhakar, Feb 5, 2009.

  1. #1
    I know this is very basic [stupid] question. But I am not a programmer, so please help me.

    I want to show a dynamic page inside another page.

    Actually, I want to display a page like this:
    something1.php?param1=something&param2=something
    Inside another page, say something2.php.

    Both are in same directory.

    How do I do this?
     
    prabhakar, Feb 5, 2009 IP
  2. steelaz

    steelaz Peon

    Messages:
    47
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If both files are in the same directory (or even the same hosting account) you can use:

    <?php include 'something1.php'; ?>
    PHP:
    If "something1.php" expects variables from URL string you can declare them before including the file:

    
    <?php
    
    $_GET['param1'] = 'something1';
    $_GET['param2'] = 'something2';
    
    include 'something1.php';
    
    ?>
    
    PHP:
     
    steelaz, Feb 5, 2009 IP
  3. prabhakar

    prabhakar Member

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    When I tried it, It didn't work. Then I again looked at the something1.php, which contained if (isset($_REQUEST["something"])) and so on.

    I guessed $_REQUEST might be similar to $_GET , and used it. It's working.:)

    Again thank you for your kind help.
     
    prabhakar, Feb 5, 2009 IP