I don't think my last reply went through, so I'm sending again. Joey Kelly <[EMAIL PROTECTED]> writes: > Y'all, > > I've got a sticky problem that I need to solve. I've just turned on > register_globals in my PHP php.ini file, and therefore have to run my form > variables through $_POST: > > $variable = $_POST[$variable]; > echo $variable;
Instead of using $variable as the key into $_POST, you really need to use name as a string, like so: $variable = $_POST["variable"]; Otherwise, PHP looks into the value of $variable (which is nothing, at that moment), and uses that as the key into $_POST, finding nothing there. > > The problem I'm having is that the script Im trying to refactor worked great > before I turned register_globals off. The script posts an array, and I can't > seem to figure out how to $_POST the array. > > Here is the script with register_globals OFF: > http://joeykelly.net/materials.php > > Here is the script with register_globals ON: > http://redfishnetworks.com/~jkelly/materials.php > Notice the huge nested array at the bottom when you click [SUBMIT]? That's my > trouble. > > In both cases, changing the extension from .php to .phps shows you the source > code. As you can see, above the form I've tried several attempts to access > the data, all of which seem to fail. > > My question: What am I doing wrong? I suspect that I'm having trouble with > nested arrays, etc.. The thing that bothers me is that the data is available > (see the array printout at the bottom?). In your source, change line 13 from $materials["quantity"][1] = $_POST[$materials]["quantity"][1]; to: $materials["quantity"][1] = $_POST["materials"]["quantity"][1]; Hope this helps, Kevin
