title: Getting value from html in php
body: <p>How can I get the value from the html in php? How can I change the ".$x." in php to result which is var click in the JavaScript. Currently, it only display the value ".x." when I click the next button.                                                                                     </p>
  
  <p>php file</p>
  
  <pre><code>&lt;?php
  
  $con=mysqli_connect("localhost","root","password","DB");
  // Check connection
  if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  $x = 1;
  
  $sql="select * from sentence where id = ".$x." limit 10";
  
  if ($result=mysqli_query($con,$sql))
  {
   // Fetch one and one row
  while ($row=mysqli_fetch_row($result))
  {
  $output = $row[1];
  }
   // Free result set
   mysqli_free_result($result);
  }
  
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>function next() {
  
  if(typeof(Storage) !== "undefined") {
      if (sessionStorage.clickcount) {
          sessionStorage.clickcount = Number(sessionStorage.clickcount)+1;
      } else {
          sessionStorage.clickcount = 1;
      }
      document.getElementById("result").innerHTML =  sessionStorage.clickcount;
  } else {
      document.getElementById("result").innerHTML = "Sorry, your browser does not support web     
  storage...";
  }
  
  }
  var click = sessionStorage.clickcount;
  
  function nextnext(){
  alert(click);
  }
  </code></pre>
  
  <p>Html</p>
  
  <pre><code> &lt;center&gt;&lt;button onclick='next()'&gt;NEXT&lt;/button&gt;&lt;/center&gt;
   &lt;div id="result"&gt;&lt;/div&gt;
  </code></pre>