title: Looping PHP Numbers To Make A Slideshow
body: <p>I have this page that looks a little like this.</p>
  
  <pre><code> &lt;div class="ecigcontainer"&gt;
   &lt;div class="backbutt"&gt;&lt;?php include("php/back.php"); ?&gt;&lt;/div&gt;
   &lt;div class="ecig"&gt;&lt;?php include("php/ecig.php"); ?&gt;&lt;/div&gt;
   &lt;div class="forwardbutt"&gt;&lt;?php include("php/forward.php"); ?&gt;&lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>A back button that works like this.</p>
  
  <pre><code>&lt;?php
  if (isset($_GET["ecig"])) {
  $back = $_GET["ecig"] - 1;
  echo "&lt;a href=\"?ecig=" . $back . "\"&gt;";
  echo "&lt;img src=\"images/ecigs/" . $back . ".png\" height=\"300px\" /&gt;&lt;/a&gt;";
  } else {
  $back = $_GET["ecig"] - 1;
  echo "&lt;a href=\"?ecig=" . $back . "\"&gt;";
  echo "&lt;img src=\"images/ecigs/" . $back . ".png\" height=\"300px\" /&gt;&lt;/a&gt;";
  }?&gt;
  </code></pre>
  
  <p>The forward button pretty much has the same code, and the display looks like this.</p>
  
  <pre><code>&lt;div class="ecigpic"&gt;
  &lt;img src="images/ecigs/&lt;?php include("php/ecigcounter.php"); ?&gt;.png" height="400px" /&gt;
  &lt;/div&gt;
  &lt;div class="ecigdesc"&gt;
  &lt;?php
  if (isset($_GET["ecig"])) {
  include("ecigs/" . $_GET["ecig"] . ".php");
  echo "&lt;h3&gt;" . $ecigname . "&lt;/h3&gt;";
  echo "&lt;p&gt;" . $ecigdesc . "&lt;/p&gt;";
  } else {
  $_GET["ecig"] = 1;
  include("ecigs/" . $_GET["ecig"] . ".php");
  echo "&lt;h3&gt;" . $ecigname . "&lt;/h3&gt;";
  echo "&lt;p&gt;" . $ecigdesc . "&lt;/p&gt;";
  }?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>With the "ecigcounter" that does this.</p>
  
  <pre><code>&lt;?php
  if (isset($_GET["ecig"])) {
  echo $_GET["ecig"];
  } else {
  $_GET["ecig"] = 1;
  echo $_GET["ecig"];
  }?&gt;
  </code></pre>
  
  <p>But the whole reason for this question is, how to I make it so it only displays numbers 1-40? Kind of lost and can't really seem to figure it out, and put it where it needs to go.</p>