PHP- how to allow only letters in a text field. Also how to only allow numbers in a text field
<p>How do I add a input field that only accepts letters. Also how do I add a input field that only accepts numbers. And once the user inputs say letters in a text field that only accepts numbers it gives an error. </p>

<pre><code>if(empty($_POST['firstname']))
        {
            $errors['firstname1'] = " Required";
        }

    if(empty($_POST['zip']))
        {
            $errors['zip1'] = " Required";
        }

    &lt;!-- Letters only for firstname --&gt;

    &lt;p&gt;
                &lt;label for="firstname" class="label"&gt;&lt;font color="#040404"&gt;*First Name:&lt;/font&gt;&lt;/label&gt;
                &lt;input class="textinput" id="firstname" type="text" name="firstname" value="&lt;?php if(isset($_POST['firstname'])) echo $_POST['firstname']; ?&gt;" /&gt;&lt;?php if(isset($errors['firstname1'])) echo $errors['firstname1']; ?&gt;
            &lt;/p&gt;
    &lt;!-- Letters only for zip --&gt;

    &lt;p&gt;

                    &lt;label for="zip" class="label"&gt;&lt;font color="#040404"&gt;*Zip Code:&lt;/font&gt;&lt;/label&gt;
                    &lt;input id="zip" type="text" name="zip" value="&lt;?php if(isset($_POST['zip'])) echo $_POST['zip']; ?&gt;" /&gt;&lt;?php if(isset($errors['zip1'])) echo $errors['zip1']; ?&gt; &lt;?php if(isset($errors['zip2'])) echo $errors['zip2']; ?&gt;
                &lt;/p&gt;
</code></pre>