title: Setting up the maximum value for html input number from database
body: <p>So I need to set the maximum value of an input number to the quantity left in the database. Is it possible or is there some ways to do this cause I need to validate first if the input value is equal or less than to the stocks left and if greater than it will prompt the message that the input must be less than or equal to the maximum value. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php    
     include('config.php'); 
     $resulta = mysql_query("SELECT * FROM inventory WHERE id = '$id'");
  
     while($row = mysql_fetch_array($resulta)) 
     {
       echo 'Stock Left: ' . $row['qtyleft'];
     }
  
     $stockstring = $row['qtyleft'];
  
     //$row['qty'] &gt; = $_post['input_value'];
  
     echo '&lt;label style="color:#000000;"&gt;Qty:';
     echo '&lt;input type="number" min="1" max="'.$row['qtyleft'].'" id="qty" name="qty" required = "required" /&gt;&lt;br&gt;';
  ?&gt;
  </code></pre>