Re: Confused - $GLOBALS

From: Date: Thu, 09 Dec 2004 20:52:26 +0000
Subject: Re: Confused - $GLOBALS
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-203866@lists.php.net to get a copy of this message
On Thu, 2004-12-09 at 12:40 -0800, Richard Lynch wrote: > My best guess from skimming your code is that you need: > > global $_POST; > > in the function that uses $_POST. > > Or is $_POST always global anyway? > > I always forget, because they changed it around on POST/GLOBALS/etc at > some point, but only on some of them. Grrr. > After reading this again, the function does not use $_POST at all. here it is again. function html_template() { global $item_pics1; if (file_exists('item.html')) { print "This is item_pics1" . $item_pics1; $html_template = $GLOBALS['html_template']; $html_template = str_replace('{item_pictures}', $item_pics1, $html_template); $html_template = str_replace('{title}', $GLOBALS['title'], $html_template); $html_template = str_replace('{description}', $GLOBALS['descrip'], $html_template); $html_template = str_replace('{price}', $GLOBALS['price'], $html_template); $item_file_name = $GLOBALS['root_dir'] . "/" . $GLOBALS['dir'] . "/item.html"; $item_fh = fopen($item_file_name, 'x+'); fwrite($item_fh, $html_template); } else { $GLOBALS['errors'] .= "item.html template does not exsit"; } }

« previous php.general (#203866) next »