We have a site policy that requires people to show a "best effort" attempt at solving the problem themselves. We don't do homework or provide custom programming without seeing something from you. If you need an example of how to do something, try doing a Google search or looking in a book. What you are asking here can be a bit too lengthy for a simple answer.
Now if you have some code you are trying to get working, please show it here and we can certainly show you where you are going wrong.
Help us help you!