end goal: HTML element is click i want to run PHP functions
so i want to do something like this
function byeBye(page) {
if (page == 'teacher.php') {
<?php $_SESSION['AccType'] = 1; ?>
} else if (page == 'admin.php') {
<?php $_SESSION['AccType'] = 2; ?>
}
console.log('Redirecting to ' + page);
window.location.href = './' + page;
}
</script>
and it called with something like this
<li id='admin' class="list-group-item" onclick="byeBye('admin.php')">
but you can see what is wrong with that. what is the right way to do this?