[eluser]eoinmcg[/eluser]
have you tried debugging it yourself?
nobody is going to write your code for you. the best way to learn is break the problem down into small steps. and lots of coffee
read your code carefully, read through the excellent user guide and search the forums - these problems have been solved many, many, times here.
good luck!