I've been searching for this solution for a while now and found some thread that were made previously regarding my same problem. But I still could not solve my problem. It's been days now and I still can't keep the array data from my HTML form to be stored in session. It just get overwritten every single time. Is there something wrong my my coding?
This is my PHP file that processes the input
<?php
if(!isset($_SESSION)){
session_start();
}
$student1 = array(
array(
'Name'=>$_POST['name'],
'Matric-No'=>$_POST['matric'],
'Gender'=>$_POST['gender'],
'Day'=>$_POST['DOBDay'],
'Month'=>$_POST['DOBMonth'],
'Year'=>$_POST['DOBYear'],
'Citizen'=>$_POST['citizen'],
'Marital'=>$_POST['kahwin'],
'Religion'=>$_POST['religion'],
'Active'=>$_POST['active'],
'Year-of-Study'=>$_POST['Cyear'],
'ID-Number'=>$_POST['idno'],
'Email'=>$_POST['email']
)
);
$_SESSION['data'] = $student1;
print_r($_SESSION);
?>
*Edit: So sorry... I forgot to mention that I do have a javascript validator to see if the user has successfully entered every form before submitting. And my problem is that when I refresh or go back to the form site, the previous data will not be there and if there is any new data that is entered. The previous data will be overwritten
$_POSTarray empty or filled with your expected values?