Are you using a mySQL database to store the information? If so, you can set the student id field to auto increment (that means it automatically increments the student id field for you as you add entries).
Then on your webpage, you'd post all the information you want to add for the student e.g. name, gender etc and add it to the database, but when you do, don't add any value for the student_id field e.g.
$insert = mysql_query("INSERT into students (student_id, name, gender, course) values ('NULL', 'Sarah', 'female', 'Computer Science')")
Hope this helps!