Hi everyone,

So, I'm trying to receive POSTed data which is being sent from Flash
structured as a nested array pictured (conceptually):

"id" contains (a, b, c)
"a" contains (prop1 => a1, prop2 => a2, ...)
"b" contains (prop1 => b1, prop2 => b2, ...)
"c" contains (prop1 => c1, prop2 => c2, ...)

where a1, a2, b1, b2, c1, c2 are values stored in the keys prop1, prop2 etc.
of their respective arrays.  That's the conceptual structure, but that isn't
how the information is passed to PHP from Flash.  In Flash (which uses "."
notation for arrays), the data is packaged with a LoadVars object (for those
who care) as follows:

postObject.id1
postObject.id1.prop1 = a1
postObject.id1.prop2 = a2
...
postObject.id2.prop1 = b1
postObject.id2.prop2 = b2
...
etc.

I *think* this data *should be* received by PHP (with dots converted to
"_" since that's what I've read php does) in the $_POST array as follows:

$_POST contains (id1 -> a, id1_prop1 -> a1, id1_prop2 -> a2, ..., id2 -> b,
id2_prop1 -> b1, id2_prop2 -> b2, ...)

However, that's not what I appear to be getting from the $_POST array.  When
I run this code:

/*************************************/
$data = $_POST;
$stuff = "\n \n Post contains:";

foreach($data as $prop => $val) {
    $stuff .= "\n {$prop}: {$val}";
}
/*************************************/

and write $stuff to a .txt file, I get the following output:

Post contains:
id1: a
id2: b
id3: c

and that's it!  No information at all about id1_prop1, id1_prop2, id2_prop1,
etc etc.

I am really stuck at this point.  Does anyone know how multidimensional
information is passed to the $_POST variable?  I know it can be done with
HTML forms and arrays, but I'm using flash and so I think my
multidimensional array of information simply gets flattened into a
one-dimensional array when POSTed as a described above (since Flash uses dot
notation for arrays and php changes dots to underscores and just makes it
one long variable name).  And that would work fine if that's what it was
doing, but, for some reason, $_POST doesn't seem to be receiving the second
array dimension at all which contains all of my property information (which
should have been flattened into the first dimension).

If that's doesn't make any sense please let me know and I will attempt to
clarify.  Otherwise, any and all help is very much appreciated!

Andy

Reply via email to