title: show hide accordion tabs depending on php variable session
body: <p>I am trying to show amount of accordion tabs depending on php variable present in session</p>
  
  <p>I have a simple accordion <em>(see bellow)</em>.</p>
  
  <p>And I have a switch statement of variables <em>(see bottom)</em>, I am trying to work out a easy way to display some of sections depending on the variable active withing the switch statement.</p>
  
  <p><strong>for example</strong> </p>
  
  <p>if <code>var1</code> present hide <code>section2</code> and <code>section3</code>.</p>
  
  <p>if <code>var2</code> present hide <code>section2</code>.</p>
  
  <p><strong>One Idea I had (First Idea)</strong></p>
  
  <p>I could pop different accordions into different PHTML pages and include depending on the statement, but this is repeating code many times, I feel like there should be a more efficient method where I hide and show accordion tabs depending on the variable.</p>
  
  <p><strong>A different Idea I had (Second Idea)</strong></p>
  
  <p>give each section a class, then using the case statement hide the class</p>
  
  <pre><code> &lt;?php
          switch ($_SESSION['buy_test_session']) {
              case "var1":
               //--//
                  break;
              case "var2":
                  ?&gt;
                  &lt;style type="text/css"&gt;
                      .section1 {display:none;}
                      .section3 {display:none;}
                  &lt;/style&gt;
          &lt;?php
                  break;
              case "var3":
                  //--/
                  break;
  </code></pre>
  
  <p><em>If All else fails my Second Idea will work and ill go with that</em></p>
  
  <p><strong>My Current Code</strong></p>
  
  <p><strong><em>accordion</em></strong></p>
  
  <pre><code> &lt;div id="accordion"&gt;
  
    &lt;h3&gt;Section 1&lt;/h3&gt;
    &lt;div&gt;
      &lt;p&gt;
     text
      &lt;/p&gt;
    &lt;/div&gt;
  
    &lt;h3&gt;Section 2&lt;/h3&gt;
    &lt;div&gt;
      &lt;p&gt;
      text
      &lt;/p&gt;
    &lt;/div&gt;
  
    &lt;h3&gt;Section 3&lt;/h3&gt;
    &lt;div&gt;
      &lt;p&gt;
     text
      &lt;/p&gt;
    &lt;/div&gt;
  
    &lt;h3&gt;Section 4&lt;/h3&gt;
    &lt;div&gt;
       &lt;p&gt;
     text
      &lt;/p&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong><em>Switch Statement</em></strong></p>
  
  <pre><code> &lt;?php
              switch ($_SESSION['buy_test_session']) {
                  case "var1":
                    //hide section 2 and 3//
                      break;
                  case "var2":
                      //hide section 2//
                      break;
                  case "var3":
                    //--//
                      break;
                  case "var4":
                           //--//
                      break;
  
                  default:
                      echo "Normal";
              }
              ?&gt;
  </code></pre>