SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Variable order in php.ini

    Hi Guys
    Below is my program to check the variables order in php.ini.
    It is EGPCS.

    So, I should get the output as 10.

    But I am getting nothing.

    Value =

    PHP Code:
    $_SESSION['txt'] = 10;
    setcookie('txt',20);
    if(
    $_POST['submit1']) {
        echo 
    "Value="$txt;
    }
    echo 
    "<br/>";

    <!
    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml">
    <
    head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <
    title>Untitled Document</title>
    </
    head>

    <
    body>
    <
    form name="frm1" action="egpcs.php?txt=30" method="post">
    <
    input type="text"  name="txt" value="40" />
    <
    input type="submit" name="submit1" value="Click" />
    </
    form>
    </
    body>
    </
    html
    What is the problem with variable order?
    Barbara

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Manchester, UK
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this may be a stupid question but do you have register_globals turned off?

  3. #3
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, register_globals = Off
    Barbara

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    use $_REQUEST to use variable order. (S is server not session)

    variables_order string Sets the order of the EGPCS (Environment, Get, Post, Cookie, and Server) variable parsing. For example, if variables_order is set to "SP" then PHP will create the superglobals $_SERVER and $_POST, but not create $_ENV, $_GET, and $_COOKIE. Setting to "" means no superglobals will be set.

    If the deprecated register_globals directive is on (removed as of PHP 6.0.0), then variables_order also configures the order the ENV, GET, POST, COOKIE and SERVER variables are populated in global scope. So for example if variables_order is set to "EGPCS", register_globals is enabled, and both $_GET['action'] and $_POST['action'] are set, then $action will contain the value of $_POST['action'] as P comes after G in our example directive value.

    Note: The content and order of $_REQUEST is also affected by this directive.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

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