title: Trying to make a webpage refresh counter
body: <p>I want to count the number of times my web page is "refreshed". Then display a message on the page along with the number of refreshes.</p>
  
  <p>For e.g- on the first refresh, the following statement shows up - "1 refresh, keep going" and so on. The sentences will keep changing with the number of refreshes. I need to print up to 10 sentences at least. </p>
  
  <p>Initially, I thought that I'll just put the sentences in an array and then use cookies to count the number of refreshes and then display the corresponding sentence according to the number of refreshes.<br>
  However, cookies are a problem as they store strings and not integers. I tried using the <code>Number()</code> and <code>parseInt()</code> functions but they don't seem to work and for some reason using JavaScript for this messes up my entire web page.</p>
  
  <p>Then I thought of using sessions in PHP. They also seemed nice at first approach and my kind of thing (because I don't like doing anything on the client side). But they also don't work and I get half of my print statement on my web page. No counter, nothing.</p>
  
  <p>I have read the previous questions.<br>
  I have tried cookies.<br>
  I have tried sessions.</p>
  
  <p>My PHP file for counter - </p>
  
  <pre><code>&lt;?PHP
  session_start();
  
  if(isset($_SESSION['views'])) {
      $_SESSION['views'] = $_SESSION['views']+ 1;
  } else {
      $_SESSION['views'] = 1;
  }
  echo "Total page views = ". $_SESSION['views'];
  ?&gt;
  </code></pre>
  
  <p>My <code>index.html</code> file contains this script at the end to run the above script which is stored in a different file named <code>counter.php</code>.</p>
  
  <pre><code>&lt;?php
  echo "&lt;hr&gt;&lt;div align=\"center\"&gt;";
      include_once "counter.php"; // this will include the counter.
  echo "&lt;/div&gt;";
  ?&gt;
  </code></pre>
  
  <p>However, when I load my page I only get <code>"; include_once "counter.php"; // this will include the counter. echo ""; ?&gt;</code> at the bottom.</p>
  
  <p>Any solution is welcome. Cookies or Sessions or whatever. I need to get this thing up and running.  </p>
  
  <p>P.S- very sorry but I can't really provide the link to my web page as I have to keep it confidential up to the 15th of February, 2017.</p>