title: How HTML FORM take only letters not numbers?
body: <p>In may Addvalue.php file 3 fields id, name, color… in id only numbers allow, in name and color only letter is allowed. Values successfully inserted into my database, but the problem is when user write NAME and COLOR in the HTML FORM field only LETTERS allow to write, if write any NUMBER message appears "Only letter allowed".... But it takes both Numbers and Letter. here is my both file  code: </p>
  
  <p>Addvalue.php code:</p>
  
  <pre><code>&lt;form  method="post" action="addh.php"&gt;
  &lt;input type="number" name="id"  id="id" required /&gt; &lt;span class="error"&gt;* &lt;/span&gt; 
  &lt;input type="text" name="name" id="name" required /&gt; &lt;span class="error"&gt;* &lt;/span&gt;
  &lt;input type="text" name="color" id="color" /&gt;
  &lt;?php
  include("config.php");
  if (isset($_POST["submit"])) {
                   $id = $_POST["id"];
        $name = $_POST["name"];
        $color = $_POST["color"];     
       if (!preg_match("/^[a-zA-Z -]+$/",$name)) {
         echo "Only letters allowed"; 
       } 
   if(!preg_match("/^[a-zA-Z -]+$/",$color)) {
         echo "Only letters allowed"; 
       }
       }
  ?&gt;
  </code></pre>
  
  <p>addh.php code:</p>
  
  <pre><code>&lt;?php
  include("config.php");
      $sql="INSERT INTO honda (id, name, color)
  VALUES ('$_POST[id]','$_POST[name]','$_POST[color]')";
      $result = mysqli_query($link,$sql) or die(mysqli_error($link));
      echo "Values Inserted";
  ?&gt;
  </code></pre>