Before we get too carried away here :), what didn't work with your original
solution? I would have guessed that it would work. What was the error?
But, here's some more with the loop, definitely not tested:
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
if(is_array($val)) {
if(count($val) > 0) {
reset($val);
while(list($key2,$val2)=each($val)) {
$GLOBALS[$key][$key2] = $val2;
}
}
}
}
> -----Original Message-----
> From: Jason [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 14, 2001 2:40 PM
> To: Johnson, Kirk; Php-General
> Subject: RE: [PHP] Easily Making Post Vars Session Vars
>
>
> Ok, I see where that's going.
>
> I actually was a bit off in my first posting.
>
> The form field names are a multi-dimesional array. The goal it to make
> writing all of the info to the db a breeze.
>
> ie- name="cust[personal][phone]"
>
> and name="cust[history][interests]"
>
> etc etc
>
> lets also say
> $cust[history][interests] = "tv";
>
> The reasoning behind it is the data does not need to be stored in a
> consistent or usable (just readable) manner. so... say
> history is a table,
> and has a column name details.
>
> I would cycle through the array two levels deep on the first
> associative
> "history", i suppose with nested while(list = each).
>
> The two values I want to return from that array would be the
> 2nd associative
> key name and the value, in this case "interests" and "tv".
>
> SO... back on track... how would i utilize that loop below to get my
> multi-dimesion form variables into a session. Once I get it
> into a session I
> think I can break it up no problem.
>
> Thanks.
>
> > -----Original Message-----
> > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 14, 2001 1:07 PM
> > To: Php-General
> > Subject: RE: [PHP] Easily Making Post Vars Session Vars
> >
> >
> > This isn't quite what you are asking, but maybe it will be of
> > help. Use the
> > loop below to create and assign GLOBAL versions of the
> $HTTP_POST_VARS:;
> >
> > reset($HTTP_POST_VARS);
> > while(list($key, $val) = each($HTTP_POST_VARS)) {
> > $GLOBALS[$key] = $val;
> > }
> >
> > Kirk
> >
> > > -----Original Message-----
> > > From: Jason [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, May 14, 2001 1:32 PM
> > > To: Php-General
> > > Subject: [PHP] Easily Making Post Vars Session Vars
> > >
> > >
> > > Hi,
> > >
> > > So, is there anyway to assign $HTTP_POST_VARS to a session
> > > array holding the
> > > same values without assign each variable one by one (there
> > > are a ton of
> > > variables).
> > > [snip]
> > > I tried doing something like this and it didn't seem to work:
> > > session_start();
> > > if(!isset($custinfo)) {
> > > session_register("custinfo");
> > > $custinfo = array();
> > > }
> > > $custinfo = $HTTP_POST_VARS;
> > >
> > >
> > > So, it doesn't appear it will be that easy. Anybody have any
> > > hints on doing
> > > this?
> > >
> > > Thanks!
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> >
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]