There is no yes or no answer to your question or THE way to do it. Let's start with the restriction (>5 characters).
Regarding the length: Yes and no. Check this one
Is there a minlength validation attribute in HTML5?
However it's not the best way in my opinion.
Regarding numbers only... well there's an "number"-input type i think. But browser support is poor so its not really a solution.
So two ways to do it. Do it on the client side (Javascript) or on the server side (PHP). Javascript enables you to validate the input before it is send. BUT: A user who has JS disabled or who is evil enough to manipulate your script (it's easy. you can even "hack" a JS-Validation with the build in tools in Chrome or FF) will easily get around your validation. So any form input must be validated on the server side anyway. In case you are about to use his input for e.g. mysql-querys or something BE SURE TO CHECK IT for malicious contents. For some examples and "illustration" you might check wikipedia using the keyword "SQL-Injection".
So what you have to do:
if(strlen($_POST['student_ID'])<5) { echo "Error! >5 characters"; }
and for the numeric input
if(!is_numeric($_POST['student_name']) { echo "Error! Nums only.";}
However front end validation still is helpful as the user gets direct feedback. You might check the JS "onchange" (triggered each time the value changes) or "onblur" (field lost focus so you can assume that the user has finished to type in his values) attribute. The check itself works almost the same in JS. You could use the alert-function to notify the user then.
Hope this helps. Happy coding.