
June 9th, 2003, 10:45 PM
|
|
Guru-in-training
|
|
Join Date: May 2002
Location: Not where I want to be...yet!
Posts: 38
Time spent in forums: < 1 sec
Reputation Power: 7
|
|
|
Re: Learning PHP
Quote: Originally posted by picker999
The only way I began to understand php was studying C\C++. Of course basic html is necessary but also forms and knowing what variables do helps a lot. I am somewhat behind though in my keeping current on what is happening. For instance I am not sure what the differences are for Register Globals being off and on. I just took over a site's management and although it seems to be working okay the latest php environment recommends Register Globals be off. The site does not work when I have register globals off. What do I have to do to site programming to have it work with register globals off. Is there a definitave article on this concept somewhere? |
You could try the http://www.php.net for a definitive guide, to understand the changes required for your site's code, and change all instances of code where your variables are passed from forms, cookies, sessions, etc, or you could write a simple script to loop through the superglobals and assign them to variable names using variable variables.
I use the second approach where I'm too lazy to actually go and recode hundreds of pages. Instead, what I do is include code snippets in a file I include in most (or all) other pages. Something like :
Code:
<?php
if (!empty($_POST)) {
foreach ($_POST as $varVarname=>$varVarValue) {
$$varVarName = $varValue;
}
};
?>
This allows me to use the name of the variable passed by the form in the same way as I would if register_globals is on.
HTH.
|