Page 1 of 1

globals question ...

Posted: Wed Aug 22, 2007 7:47 am
by Avihai
Hi all,

I've got me a flash form that send the vars to php using the sendAndLoad.
I am trying to get one of the flash vars into a global variable in php and use it all
over the website, whenever I what and in whatever file I need.

All is working well except the global php.

That is the relevant part in php:

global $title;
$title = $_POST['Title'];

Can anyone help?

Thanks,
A.O

Posted: Wed Aug 22, 2007 7:50 am
by feyd
"global" doesn't mean "accessible across pages." It merely means that it is easily accessible on a single page request. You're thinking of sessions.

Posted: Wed Aug 22, 2007 8:03 am
by Avihai
feyd,

Thanks for the quick reply.
Could you please explain a bit more?

Thanks,
A.O

Posted: Wed Aug 22, 2007 8:06 am
by VladSun

Thanks VladSun - got it :-)

Posted: Wed Aug 22, 2007 8:38 am
by Avihai
:-)

Posted: Wed Aug 22, 2007 10:26 am
by RobertGonzalez
Global means globally accessible within the current request. That means when a user calls the page about.php, any code you have written that is accessed or built into about.php has access to the global variable. To get values accessible across multiple requests (say on about.php and contact.php) you will either need to use sessions or cookies, both of which can be easily found on a search of the PHP manual.