$newLoanDate); $_SESSION['temp_loan'][$loanSessionID]['loan_date'] = $newLoanDate; } if (isset($_POST['newDueDate']) && trim($_POST['newDueDate']) != '') { $newDueDate = trim($_POST['newDueDate']); $newDates = array('newDate' => $newDueDate); $_SESSION['temp_loan'][$loanSessionID]['due_date'] = $newDueDate; } // parse to json echo json_encode($newDates);