Typicaly, unless you have serious concerns about browser compatibility, this is the kind of thing that can best be done in javascript, so the user doesn't have to wait for the page to reload just to view the data in a different sort order.
I would argue that this depends on the nature of the application.
Due to the nature of the data I am working with I usually end up with a form consisting of an updatable grid of <input type=text name=new-XXX-YYY> and <input type=hidden name=old-XXX-YYY> I can then update only the changed values relative to the old form that haven't been updated in the mean time. With warnings if the underlying data has changed.
Sorts with large data sets are best handled server side so that you can page the data. 5000 rows would not be fun in a single page.
Again the best solution for you will depend on the size, complexity and speed of change of your data.