Re: switch-statement overrides use of global arrays?

From: Date: Mon, 29 Oct 2001 20:18:32 +0000
Subject: Re: switch-statement overrides use of global arrays?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72767@lists.php.net to get a copy of this message
On Sunday 28 October 2001 22:17, Imar de Vries wrote: > Hi all, > > a very frustrating problem. For some reason I am not able to pass on an > array between two functions, although I declare it global in both of > them. I suspect my use of a switch statement to control the flow of the [...] > switch ($action) { > default: > main(); > break; > case "test_one": > test_one(); > break; > } [...] > print ("<p><form method=\"post\" action=\"arraytest.php\" > enctype=\"multipart/form-data\">"); > ?> > <input type="hidden" name="action" value="test_one"> > <input type="submit" value="Test" tabindex="6"> > </form> > <? > } So you want to share the array across *requests* That doesn't have *anything* to do with "global". Have a look at how HTTP works - each request is an isolated execution of a PHP script. it doesn't have any idea of what other pages the user already looked at. To archieve your stuff you need session management (phpbuilder.com has a nice tutorial on this) -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) This is JohnC IMHO, I compaired tri-word groupings here and in his plan and got a good match. - /. posting discussing the likelihood that an AC post that claimed to be posted by John Carmack during his honeymoon (and having the login info at home) was actually from him.

« previous php.general (#72767) next »