Basically I use the MVC (Model View Controller) architecture when building my php scripts. So all of my logic is handled by a controller which calls methods on functions, that way the php scritps that are used to display forms, tables etc. have little to no business logic to them at all. Now in the controller I woul find it pretty annoying if I had to reference either the $HTTP_POST_VARS or $HTTP_GET_VARS aarry, so to add to the fact that it would make the code look more messy than it needs to be. So all I wanted to know was is it possible to use 'global $GLOBAL' within a function?
On Sun, 23 Dec 2001 18:35:33 -0600 "Gaylen Fraley" <[EMAIL PROTECTED]> wrote: > Why aren't you using the $_POST or $HTTP_POST_VARS array? > > -- > Gaylen > [EMAIL PROTECTED] > Home http://www.gaylenandmargie.com/ > PHP KISGB v2.6 Guest Book http://www.gaylenandmargie.com/phpwebsite/ > > "Philip Maciver" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Does anyone know if it is possible to use the > > > > 'global $varName' > > > > function with the '$GLOBALS' array itself. > > > > I have been having some trouble with this. I have decieded to switch of > register_globals in the php.ini file (seeing as > > it is now deprecated in version 4.1.0) > > I know that register_globals is still supported, but I would like to get > used to not using it. > > But anyway, the problem I am having is that when I post data from a form > to another page the data is not available > > globally, so I wrote a method to register them globally, it looks like > this > > > > function globaliseVars($varArray) { > > global $GLOBALS; > > > > while (list($varName,$var) = each($varArray)) { > > $GLOBALS[trim($varName)] = trim($var); > > } > > } > > > > But doing 'global $GLOBALS' doesn't seem to make it refer to the actual > '$GLOBALS' array, the only time it did work was > > when I place something into the '$GLOBALS' array on the page that calls > the function. So > > > > /** > > * This doesn't work > > */ > > globaliseVars($HTTP_POST_VARS); > > > > > > /** > > * But this does > > */ > > $GLOBALS["ANYTHING"] = "anything"; > > globaliseVars($HTTP_POST_VARS); > > > > If anyone could help me with this problem please could they get in touch, > because its driving me crazy. > > > > Thanks! > > > > ============== > > Philip MacIver > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] ============== Philip MacIver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]