Hi everyone
I am having problems keeping values of arrays. I want a form that when a user types a value and hits submit button that value is read into an array then displayed on the page. Every time the user types a value, all values show.
in my submit test I have
$title[$roomcount] = $_POST['title'];
$roomcount++;
each time the user hits submit the $roomcount variable increases. The first element ref in the array is 0, then 1 ..etc
I have tried all sorts to keep the values stored in $title but it only remembers the last input entered. I know I would have to probably use $_SESSION['title'] and read the array back into $title but have problems.
I have tried
$_SESSION['title'] = serialize($title);
then
$title = unserialize($_SESSION['title']);
but that doesnt remember more than 1 entry the rest are empty.
I could try a foreach statment loop but I dont know the syntax for accessing arrays with $_SESSION['title']
is it $_SESSION['title[0]']
this seams to act as though title[0] is actually the name for the variable rather then have the array ref at the end.
I have also tried $_SESSION['title'][0] and $_SESSION[$title[]] but I think I just got the server laughing at me
Thanks