0

To my knowledge, PHP $_POST is expecting data in the form of 'Key1=Value1&Key2=Value2&(ect..)'. This is the format my application POSTs data to my website. I'm trying to figure out what the format for a multi-dimensional array would be, say 3 dimensions.

Here is what I am thinking: 'MainTable = Table1 = Table1Key1 = Value1 & Table2 = TableKey2 = Value2'

This is my proposed multi-dimension post as a string.

Please help me understand and correct this string!

2
  • 1
    I'm not sure what the question is, but $_POST is an array. What you reference looks a lot like $_GET Commented Aug 19, 2014 at 18:07
  • 1
    @jboneca — The default data format for POST data in HTML forms is identical to the query string on URLs. Commented Aug 19, 2014 at 18:07

2 Answers 2

3

The PHP syntax for form data to be expressed as a multidimensional array is:

key[subkey][subsubkey]=1&key[subkey][subsubkey2]=2

And then you can access it via:

$_POST['key']['subkey']['subsubkey'];
$_POST['key']['subkey']['subsubkey2'];
Sign up to request clarification or add additional context in comments.

2 Comments

And they can be dynamic key[]=1&key[]=2 or key[subkey][]=1&key[subkey][]=2 etc.
This answer is the same content as mine, deleting my response!
0

This answered my question! My new understanding is that my application should post strings in the following format:

MainTable[Table1][Key1InTable1]=SomeValue&MainTable[Table2][Key1InTable2]=SomeValue

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.