title: Dynamic Bootstrap Carousel From Image Array
body: <p>What i'm trying to do here is create a bootstrap carousel from an array containing image urls, i cannot see where i have messed up, currently it displays like: <a href="https://www.we-love-unicorns.club/301-baby-unicorn-top/" rel="nofollow noreferrer">https://www.we-love-unicorns.club/301-baby-unicorn-top/</a> with one image on top of each other.</p>
  
  <p><strong>My Code so far:</strong></p>
  
  <pre><code>&lt;!-- Dynamic carousel --&gt;
  
  &lt;div id="mainCarousel" class="carousel slide" data-ride="carousel"&gt;
  
    &lt;!-- Indicators --&gt;
    &lt;ol class="carousel-indicators"&gt;
  
      &lt;li data-target="#mainCarousel" data-slide-to="0" class="active"&gt;&lt;/li&gt;
  
      &lt;?php
  
          for ($c = 1; $c &lt;= count($p['images']); $c++) {
              echo "&lt;li data-target=\"#mainCarousel\" data-slide-to=\"".$c++."\"&gt;&lt;/li&gt;";
          } 
  
      ?&gt;
  
    &lt;/ol&gt;
  
    &lt;!-- Wrapper for slides --&gt;
    &lt;div class="carousel-inner"&gt;
  
      &lt;div class="item active"&gt;
      &lt;?php
  
          for ($c = 0; $c &lt;= count($p['images']); $c++) {
              echo "&lt;img src=\"{$p['images'][$c]}\"&gt;";
          } 
  
      ?&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  
    &lt;!-- Left and right controls --&gt;
    &lt;a class="left carousel-control" href="#mainCarousel" data-slide="prev"&gt;
      &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt;
      &lt;span class="sr-only"&gt;Previous&lt;/span&gt;
    &lt;/a&gt;
  
    &lt;a class="right carousel-control" href="#mainCarousel" data-slide="next"&gt;
      &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;
      &lt;span class="sr-only"&gt;Next&lt;/span&gt;
    &lt;/a&gt; 
  &lt;/div&gt;
  
  &lt;!-- Dynamic carousel --&gt;
  </code></pre>
  
  <p>At this part: <strong>count($p['images']);</strong> is where i do a count of the images in the array, then proceed from there to show the display, i feel i have missed something small but i cannot see where, any help would be appreciated!</p>