I am initialising the session with the variable name fromSelectStudentPage to 1 when the button CONTINUE is clicked.
when i reload the page just for testing the session gets initialised to 1 even without calling the function.
<form id="forStudent">
<button type="button" on-click="onSelectStudent();">CONTINUE</button>
</form>
function onSelectStudent() {
if(checkStudType()) {
<?php $_SESSION['fromSelectStudentPage'] = '1'; ?>
$('form#forStudent').submit();
}
}