title: How to increment a variable between two pages in which I loop
body: <p>I have three pages, when I click on a button on the first one I go to the second one and when I click another button in the second one I go to the third one. Then, when I click on a button in the third one, I go back to the second one
  There is a variable that I increment every time I go to the third page but when I go back to the second page, even though I send the variable back and incremented to the second page, the variable remains the same as before I went t the third page.</p>
  
  <p>page 1:</p>
  
  <pre><code>&lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;title&gt; Evaluation des enseignements &lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" name="style_telecommande.css" &gt; 
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;header&gt;
  &lt;h1&gt; Site de vote &lt;/h1&gt;
  &lt;h2&gt; Bienvenue sur le site d'évaluation des enseignements &lt;/h2&gt;
  &lt;/header&gt;
  &lt;p&gt; Entrez votre numéro étudiant INE &lt;/p&gt;
  &lt;form action="page-vote.php" method="post"&gt;
  
  &lt;input type="text" name="numero" value="" id="num_etu" /&gt;
  
  &lt;label&gt; Votre nom: &lt;/label&gt;: &lt;input type="text" name="name" value="" id="nom" &gt;
  &lt;label&gt; Votre prenom &lt;/label&gt;: &lt;input type="text" name="validation" value="" id="ok" /&gt;
  &lt;input type="submit" name="ok" id="entree" value="Valider" /&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>page 2: </p>
  
  <pre><code>&lt;head&gt;
  
  &lt;link rel= name="style-telecommande.css" type="text/css" &gt;
  &lt;title&gt; Telecommande de vote &lt;/title&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;header&gt; 
  &lt;h1&gt; Site de vote &lt;/h1&gt;
  &lt;h2&gt; Télécommande de vote &lt;/h2&gt;
  &lt;/header&gt;
  &lt;?php
  if (isset($_POST["num_question"]))
  {
  //here is the instruction executed when I come from the third page, the variable doesn't correspond to what I sent
  $question_pg_vote= max(1, min(20,(int) ($_POST["num_question"])));
  
  echo $question_pg_vote;
  echo 'yes';
  }
  else {
  //here is the instruction executed when I come from the first page, everything works until then
      echo 'nope';
      $question_pg_vote=1;
  }
  //echo '&lt;p&gt; question numéro '.$question.' &lt;/p&gt;';
  echo'
  &lt;form action="page_validation.php" method="post"&gt;
  &lt;input type="submit" name="reponse1" value="A" /&gt;
  &lt;input type="submit" name="reponse2" value="B" /&gt;
  &lt;input type="submit" name="reponse3" value="C" /&gt;
  &lt;input type="submit" name="reponse4" value="D" /&gt;
  &lt;input type="submit" name="reponse5" value="E" /&gt;
  &lt;input type="hidden" name="numero_question" value="question_pg_vote" /&gt;
  &lt;/form&gt;
  ';
  ?&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>page 3:</p>
  
  <pre><code>&lt;?php
  try
  {
  $bdd = new PDO('mysql:host=localhost;dbname=bdd projet s8;charset=utf8','root','');
  }
  catch (Exception $e) 
  {
      die('Erreur : ' .$e-&gt;getMessage());
  }
  $question= (int) max (1,min(20, ($_POST['numero_question'])))+1;
  //echo (int) max (1,min(20, ($_POST["numero_question"])));
  if(isset($_POST['reponse1']))
  {
  $vote=$_POST['reponse1'];
  }
  if(isset($_POST['reponse2']))
  {
  $vote=$_POST['reponse2'];
  }
  if(isset($_POST['reponse3']))
  {
  $vote=$_POST['reponse3'];
  }
  if(isset($_POST['reponse4']))
  {
  $vote=$_POST['reponse4'];
  }
  if(isset($_POST['reponse5']))
  {
  $vote=$_POST['reponse5'];
  }
  // the 12 second lines are for adding data into my database, don't pay attention to them
  /*if ($question==1)
  {
  $id= random_int;
  }*/
  $reponse = $bdd-&gt;prepare('INSERT INTO reponse(id_question,id_votant,reponse_votant) VALUES(:question1,\'1\',:reponse_votant)');
  $reponse-&gt;execute(array(
  'reponse_votant' =&gt; $vote
  ,'question1' =&gt; $question
  //,'id_user' =&gt; $id 
  ));
  echo'
  &lt;form action="page-vote.php" method="post"&gt;
  &lt;input type="submit" name="retour" value="return" /&gt;
  &lt;input type="hidden" name="num_question" value="question" /&gt;
  &lt;/form&gt;
  &lt;p&gt; question '.$question.' &lt;/p&gt;
  //the line before displays the variable and I can see it has been incremented
  ';
  ?&gt;
  &lt;/body&gt;
  </code></pre>