PDA

View Full Version : Declaring, globalicing, variabling, etcing


luroca
05-22-2005, 04:44 PM
I am working in a hack of /forum/subscriptions.php and I need to use 2 variables several times in a php script.
I declare them in "($_REQUEST['do'] == 'list')" section and they work but in the next section, "($_REQUEST['do'] == 'orden')", they are not.
I think I need to globalize them (1 variable and 1 array) but I donĀ“t know how or when:

Before declaring the variables?
After declaring?
In the first section?
In the second?
As $_POST?
As $_REQUEST?

Perhaps they are silly questions but not for me. I learn much better with examples than with manuals.

Thanks in advance

Marco van Herwaarden
05-23-2005, 09:58 AM
If you will only use the variables inside 1 if-statement, it should be placed there. If you use it on more places, you could define it before other processing, or on each place you need it.

luroca
05-23-2005, 02:11 PM
Thank you, MarcoH64.