Re: HELP with Multi Dimensional Array Problem

From: Date: Fri, 09 Mar 2001 02:26:39 +0000
Subject: Re: HELP with Multi Dimensional Array Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43105@lists.php.net to get a copy of this message
In article <20010308213617.12712.qmail@web120.yahoomail.com>, omenzel@yahoo.com (Yev) wrote: > So, it sees $name="field[text][email]", and attempts to retrieve the > value, so in essense $HTTP_GET_VARS[$name] should return > "email@email.com", but it doesn't work.. > However, if i try to access $HTTP_GET_VARS[field][text][email] that > properly returns "email@email.com". The reason "it doesn't work" is because these are not the same reference. $HTTP_GET_VARS[$name] expands to: $HTTP_GET_VARS[field[text][email]] Which, as you can see, is not the same as: $HTTP_GET_VARS[field][text][email] Since you're apparently trying to access the data submitted in > <input type=text name="field[text][email]" value="email@email.com"> > <input type=text name="field[text][url]" > value="http://www.email.com"> How about using something like: extract($HTTP_GET_VARS['field']['text']); //note that index names are quoted echo $email; echo $url; ? Otherwise, if you want to stick with the original method, I believe you would use something like: $name="['field']['text']['email']"; //index names quoted, brackets added echo $HTTP_GET_VARS$name; //brackets dropped -- CC

« previous php.general (#43105) next »