Professional Web Applications Themes

How to use $GLOBALS - PHP Development

If I am understanding the doentation correctly, when you place info into $GLOBALS, it is avaialable anywhere, including on another page. Is this correct? The reason I ask is that I am putting the value of a variable into $GLOBALS, and I can get its value then and there, but when I go to another page, the value that I put into $GLOBALS no longer seems to be in existence....

  1. #1

    Default How to use $GLOBALS

    If I am understanding the doentation correctly, when you place info
    into $GLOBALS, it is avaialable anywhere, including on another page.
    Is this correct?

    The reason I ask is that I am putting the value of a variable into
    $GLOBALS, and I can get its value then and there, but when I go to
    another page, the value that I put into $GLOBALS no longer seems to be
    in existence.
    reynoldscraigr@hotmail.com Guest

  2. #2

    Default Re: How to use $GLOBALS


    On 13-Jul-2003, [email]reynoldscraigrhotmail.com[/email] wrote:
    > If I am understanding the doentation correctly, when you place info
    > into $GLOBALS, it is avaialable anywhere, including on another page.
    > Is this correct?
    no it's only available on the page in which it was set.
    >
    > The reason I ask is that I am putting the value of a variable into
    > $GLOBALS, and I can get its value then and there, but when I go to
    > another page, the value that I put into $GLOBALS no longer seems to be
    > in existence.
    saving variables between pages is often done with sessions:
    [url]http://www.php.net/manual/en/ref.session.php[/url]


    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    Tom Thackrey Guest

  3. #3

    Default Re: How to use $GLOBALS

    On Sun, 13 Jul 2003 21:56:21 +0800, [email]reynoldscraigrhotmail.com[/email] wrote:
    >If I am understanding the doentation correctly, when you place info
    >into $GLOBALS, it is avaialable anywhere, including on another page.
    >Is this correct?
    No.
    >The reason I ask is that I am putting the value of a variable into
    >$GLOBALS, and I can get its value then and there, but when I go to
    >another page, the value that I put into $GLOBALS no longer seems to be
    >in existence.
    Sounds like you're thinking of sessions.

    --
    Andy Hassall (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  4. #4

    Default Re: How to use $GLOBALS

    On Sun, 13 Jul 2003 21:56:21 +0800, [email]reynoldscraigrhotmail.com[/email] wrote:
    >If I am understanding the doentation correctly, when you place info
    >into $GLOBALS, it is avaialable anywhere, including on another page.
    >Is this correct?
    >
    >The reason I ask is that I am putting the value of a variable into
    >$GLOBALS, and I can get its value then and there, but when I go to
    >another page, the value that I put into $GLOBALS no longer seems to be
    >in existence.
    OK, thanks everyone for putting me on the right track.
    reynoldscraigr@hotmail.com Guest

Similar Threads

  1. Replies: 0
    Last Post: October 2nd, 10:52 PM
  2. #25708 [WFx]: extract($GLOBALS, EXTR_REFS); can corrupt the $GLOBALS array.
    By cdragon at draconic dot com in forum PHP Development
    Replies: 0
    Last Post: October 1st, 01:39 AM
  3. Replies: 0
    Last Post: October 1st, 12:59 AM
  4. #25708 [NEW]: extract($GLOBALS, EXTR_REFS); can corrupt the $GLOBALS array.
    By cdragon at draconic dot com in forum PHP Development
    Replies: 0
    Last Post: September 30th, 10:25 PM
  5. [PHP] Globals
    By Jim Lucas in forum PHP Development
    Replies: 4
    Last Post: August 1st, 07:20 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139