title: saving the values of drop down menu into a cookie by php
body: <p>I am trying to save the values of my drop down menu into a cookie! But the cookie shows a different value! Here is php code for it:</p>
  
  <pre><code>if (isset($_POST['myselection'])){
  
  $chooseone=$_POST['myselection'];
  setcookie ("chosenlang",$chooseone, $t);
  $setobr=$_COOKIE['chosenlang'];
  
  }
  </code></pre>
  
  <p>And this is the HTML part:</p>
  
  <pre><code>&lt;form method="post" action=""&gt;
  
  &lt;select name="myselection" id="myselection" onchange="this.form.submit();"&gt;
  &lt;option value="choose"&gt;choose your language:&lt;/option&gt;
  &lt;option value="Eng"&gt;Eng&lt;/option&gt;
  &lt;option value="Esp"&gt;Esp&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>The problem is that $setobr, shows $chosenone with a delay; meaning that when I print both, it first shows the opposite selection, and then the same selection!</p>
  
  <p>Does anyone know why is that?</p>