first you check if it is submitted, then you open a file and write the data in it and after that you redirect the page to another page. you probally want me to write the code and show you right, but im sorry i only know so far how to open and redireted it. If i really want to do this i can, but i will not untill i needed.
Hope this help you =)