views:

2480

answers:

1

When you do the following in an HTML form:

<input name="one[]" value="foo" />
<input name="one[]" value="bar" />
<input name="two[key]" value="something" />

and submit the form to a PHP page, The $_POST array will look as follows:

array(
    'one' => array(
        0 => 'foo',
        1 => 'bar'
    ),
    'two' => array(
        'key' => 'something'
    ),
),

If you look at the header data, though, it will look as follows:

one[]=foo&one[]=bar&two[key]=something

Does anyone have a script with which to convert the PHP array back into the POST data string? urlencode doesn't work as it can't acces arrays...


+7  A: 

You want http_build_query()

Greg
Why didn't I think of that!? Thanx... :)
Jrgns