PHP Examples - Session - Pageviews

PHP Examples - Session - Number of Pageviews

Program:

<?php

 session_start(); // Starting PHP Session
 if(isset($_SESSION['pageviews'])) // Checking Session variable is set or not  
  $_SESSION['pageviews']+=1;
 else
  $_SESSION['pageviews']=1; // Setting Session variable 
 
 //echo $_SESSION['pageviews'];

?>  
<html >
<head>
<title>PHP EXAMPLE 11 : SESSION </title>
</head>

<body>

<?php
 
 echo "<br/>PHP Example 11";
 echo"<br/>"; // line break
 echo"<h1>";
 echo"SESSION : Number of Pageviews";
 echo"</h1>";
 echo"<br/><br/>";
 echo "<b><h2> Number of Page Views: ".$_SESSION['pageviews']."</h2></b>";
 
 echo "<br/><b>";
 echo"WWW.2K8618.BLOGSPOT.COM";
 echo"</b>";
?>
</body>
</html>


Output:








2 comments:

  1. Dive into the intricacies of Java programming, web development, and database management with our comprehensive Full Stack Course in South Delhi.

    ReplyDelete
  2. Great information! Reliable lead generation services enable businesses to attract potential customers and convert them into long-term clients.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...