please help me out. I want to append new data to a multidimensional array but structure it the same way the original was structured. Here's what I have right now:
<?php
session_start();
$ses = session_id();
if (isset($_POST['title'])){
if(!empty($_SESSION[$ses])){
$title = $_POST['title'];
array_push($_SESSION[$ses], $title);
array_push($_SESSION[$ses], $_POST['desc']);
}else{
$title = $_POST['title'];
$_SESSION[$ses] = array(array($title, $_POST['desc']));
}
}
?>
Right now the output looks like this:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
)
[1] => 3
[2] => 4
)
But I want the 3 and 4 to be appended like this:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
)
[1] => Array
(
[1] => 3
[2] => 4
)
)
How can I modify my code to achieve that? I'm really stuck, please help!!!