This is my PHP code. My backwardCallFunction and forwardCallFunction do not work. The number displayed in:
<div class= 'call-count'>Call Count: <?php echo $_SESSION['callCount'];?></div>
Still the same. Anyone can help me solve the problem?
<?php
session_start();
$_SESSION['callCount'] = 0;
function forwardCallFunction()
{
$_SESSION['callCount']++;
}
function backwardCallFunction()
{
$_SESSION['callCount']--;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet"
href="https://fonts.sandbox.google.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"/>
<title>Document</title>
</head>
<body>
<div class='home-middle-subcontent'>
<div class='to-left' onclick="<?php backwardCallFunction(); ?>"><span class="material-symbols-rounded">keyboard_double_arrow_left</span>
</div>
<div class='call-count'>Call Count: <?php echo $_SESSION['callCount']; ?></div>
<div class='to-right' onclick="<?php $_SESSION['callCount']++; ?>"><span class="material-symbols-rounded">keyboard_double_arrow_right</span>
</div>
</div>
</body>
</html>