title: Session variable to show a form or not
body: <p>I want to show a form only if the previous form is filled and submitted. So, I created a session variable which is initialized when I submit the first form. Like this :</p>
  
  <pre><code>if( $flag)
              {
                  $_SESSION['id_essai'] = $id_essai;
                  echo $_SESSION['id_essai'];
                  insertion_base($index_essai,$id_essai,$nom_local_essai,$nombre_traitements,$essai_ou_suivis,$thematique);
              }   
  </code></pre>
  
  <p>I can get this <code>var</code> in this file because my echo works and return the value.</p>
  
  <p>After that :</p>
  
  <pre><code>if(isset($_SESSION['id_essai']))
  {
      echo'
  
          &lt;div id="tab_traitement" class="excel"&gt;&lt;/div&gt;
  
          &lt;form action="#" method="POST"&gt;
              &lt;button  type="button" class="btn btn-default" id="submit_button_traitement"&gt;Submit&lt;/button&gt;
          &lt;/form&gt; ';
  }else 
      echo'Pour saisir un traitement, vous devez d\'abord faire la saisie d\'un essai';
  </code></pre>
  
  <p>This is my Index.php :</p>
  
  <pre><code>&lt;?php session_start();?&gt;
  
  &lt;!DOCTYPE HTML&gt;
  
  &lt;meta charset="UTF-8"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt; 
  &lt;/head&gt;
  
  &lt;body&gt;
          &lt;?php include('onglets.php');?&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>In the file 'onglets.php' : I've got : </p>
  
  <pre><code>&lt;div class="tabs" id="tabs"&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#tabs-1"&gt;Essai&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-2"&gt;Traitement&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-3"&gt;ITK PRO&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-4"&gt;ITK &lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-5"&gt;Parcelle élémentaire&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-6"&gt;Prélèvement&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-7"&gt;Analyse&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-8"&gt;Mesure plante principale&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-9"&gt;Mesure plante CIPAN&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-10"&gt;Station Climatique&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
      &lt;div id="tabs-1"&gt;
          &lt;?php include('essai.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-2"&gt;
          &lt;?php include('traitement.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-3"&gt;
          &lt;?php include('itk_pro.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-4"&gt;
          &lt;?php include('itk.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-5"&gt;
          &lt;?php include('pe.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-6"&gt;
          &lt;?php include('prelevement.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-7"&gt;
          &lt;?php include('analyse.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-8"&gt;
          &lt;?php include('mpp.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-9"&gt;
          &lt;?php include('mpc.php');?&gt;
      &lt;/div&gt;
  
      &lt;div id="tabs-10"&gt;
          &lt;?php include('station_climatique.php');?&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;div id="tabid"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And I call ajax_insert_essai.php in essai.php. In ajax_insert_essai.php, I initialize $_SESSION['id_essai']. </p>
  
  <p>And I have my <code>session_start()</code> at the beginning  without something before so that's not the probem. Please, some help!</p>
  
  <p>How can I do ?</p>