Accessing GET Variables with include

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Scharlemann

    Accessing GET Variables with include

    There is probably an easy solution to this that I've overlooked
    somewhere...

    I have a main file, call it main.php, and an include file,
    myInclude.php. I'm accessing main.php via:


    main.php:
    -------------------
    <?php
    $page = $REQUEST['page'];
    if($page=="new" ) include('myIncl ude.php');
    ?>
    -------------------

    and try to access var1 and var2 from the include:
    myInclude.php:
    ---------------------
    $var1 = REQUEST['var1'];
    $var2 = REQUEST['var2'];
    ----------------------
    both $var1 and $var2 are empty in myInclude.php. How do I "see" var1
    and var2 from myInclude.php?

    Thanks!

  • Gordon Burditt

    #2
    Re: Accessing GET Variables with include

    >-------------------
    ><?php
    >$page = $REQUEST['page'];
    >if($page=="new ") include('myIncl ude.php');
    >?>
    >-------------------
    >
    >and try to access var1 and var2 from the include:
    >myInclude.ph p:
    >---------------------
    >$var1 = REQUEST['var1'];
    >$var2 = REQUEST['var2'];
    It's spelled:
    $_REQUEST['var1'];

    Comment

    Working...