The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Multiple array in Array

surgutor's Avatar

surgutor

24 Feb, 2017 11:47 AM

Hi guys

I am new in Slim, so I hope you can help me.

I have structure in POST request:

{
"siteID" : "41",
"Room_0":{
"roomID": "62",
"roomName": "Room_1",
},
"Room_1":{
"roomID": "63",
"roomName": "Room_2",
},
"Room_2":{
"roomID": "64",
"roomName": "Room_3",
},
"Room_3":{
"roomID": "65",
"roomName": "WC",
}
}

routes.php file contain code:

$app->post(API_VERSION . API_POINT . '/test', function() use ($app){
$data = json_decode($app->request->getBody(), true);
$app->render('test.php', array(
'siteID' => $data['siteID']
));
});

In test.php file I can use $siteID value and manipulate with it. But how to transmit Room_0[], Room_1[], etc arrays and values inside the arrays? There could be >=0 arrays with "Room_*" name

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac