title: Passing javascript value to php is this the right approach?
body: <p>I am very new to php.</p>
  
  <p>After all comments below i have changed the question  and i have tried with ajax as per the suggestion</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function getval(sel) {
          var get= sel.value;
          alert(get);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I have tried :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var a=get;  
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
  if (xhttp.readyState == 4 &amp;&amp; xhttp.status == 200) {
   alert( xhttp.responseText)
   }
  };
  
  xhttp.open("GET", "?a="+a, false);
  xhttp.send();
  
  &lt;/script&gt;
  </code></pre>
  
  
  
  <p>But i did not get output.</p>
  
  <p>Facing issue in xhttp.open all the code are in single page so i have not given any path.  </p>