title: button value redirect to new page
body: <p>Each product got individual “View product”  button</p>
  
  <p>Button when clicked will get the individual product code as hidden value from db and redirects page along with the product code. I am using while loop to display individual product. </p>
  
  <p>But my html not outputs as the button makes some errors</p>
  
  <pre><code>while($row = $results-&gt;fetch_assoc()) { …
  &lt;input name="product_code" type="hidden" value="{$row["product_code"]}"&gt;
      &lt;button type="submit"&gt;view product&lt;/button&gt;
  
  &lt;script src="https://code.jquery.com/jquery-3.2.1.min.js"&gt;&lt;/script&gt;   
  $('#product_code').click(function() { 
      window.location = "2ndlink.php?variable=" + encodeURIComponent(value);
        });
  </code></pre>