You have forgotten to quote the id inside the $_POST, i.e. $_POST["id"]
But why a $_POST inside a $_SESSION? Could it be either:
$sql = "UPDATE attendance SET logouttime = NOW() WHERE id = '".$_SESSION["id"]."'";
or
$sql = "UPDATE attendance SET logouttime = NOW() WHERE id = '".$_POST["id"]."'";
However, you should consider the following:
1. Switching to
mysqli extension[
^] as the ext/mysql extension has been
deprecated [
^]since PHP 5.5.
2. Use
prepared statement[
^] for the sql