When it comes to inserting the date in the correct format you will need to ensure that any insert or updates that you have format the date correctly before inserting it. You can use the regular php date formatting to do so like this:
date("Y-m-d", strtotime($_POST['the_date']));
This way it should not matter how the date is being entered as it will always be reformated to the YYYY-mm-dd format when it is being inserted or updated.
For the error you are getting with your script being declared more than once you should make sure that you do not have the function definition in the loop as well.
To sort with a jump menu you can make use of the DataAssist Sort server behavior. It will allow you to toggle the sort order based on a particular column. To sort based on a column you do not need any special relationship with the info in that column. We have a solution recipe on this in the DataAssist support page, here is a link:
dataassist/
It is titled 'sorting columns by link', check this out to get a good idea of how to use the sort server behavior.