There's a number of gradebook and rollbook apps and web services (some very good and free) already written.
Take a look here
to see some of them. A Google search for rollbook or gradebook software will get you dozens more to check out.
As was previously suggested by Selena Johnes, why reinvent the wheel unless there's something very unusual or specific that you need?