title: Show/hide Div Dynamically in PHP
body: <p>i have an array which generates The Div dynamically.Now i want to hide &amp; show the div and 1 div should be shown at a time and to show the next div the user must be click on button.something like this:</p>
  
  <pre><code>&lt;?php $h=0;?&gt;
  &lt;script stype="textjavascript"&gt;
          function test() {
            document.getElementById("set").style.display="none";
  
            document.getElementById("set&lt;?php echo $h+1; ?&gt;").style.display="block";
  
            }
  &lt;/script&gt;
  &lt;?php
  foreach($sets as $set){ 
  if($h==0)
  {
  ?&gt;
  &lt;div id="set"&gt;
  &lt;/php } else { ?&gt;
  &lt;div id="set&lt;?php echo $h;?&gt;" style="display:none;"&gt;
  
  &lt;p&gt;&lt;a class="continue" href="#" onclick="test()"&gt;Continue&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;?php $h++; } } ?&gt;
  </code></pre>
  
  <p>Now using the above code i can able to hide and show the 2 div but in the case of 3 div it is not working,please let me know where i am doing wrong.</p>