It's quite a broad subject to cover in a forum post. I would suggest you read one of the many tutorials available on the internet, as well as the section in the PHP manual that covers the subject.