Leggi qui e troverai tutte le risposte

http://www.mtxweb.ch/php_learn/?p=244