Hello. I'm learning web design for a hobby, and at the moment I'm trying to build my own website.

For this site, I am trying to build a 'contact me' page, which includes a form where people can leave their details and a small message, which will be sent to my email inbox when they complete the form. I am fine with the XHTML and CSS of building the form. The PHP, however, has me stumped.

Basically, what I want to do is have a page called example.com/contact which contains the form where the user inputs their details. I would like their name, email address and message to be required fields. If these are all validated, I would like it to move to a confirmation screen where they can quickly check the message and details, and hit a submit button. When they do this, I would like it to send the info to my email address.

I have to make sure that the PHP is as secure as possible, so that the form or server won't be affected by spam or people putting code into any of the text inputting areas.

I want to learn how to do this myself, rather than just copy some script and not understand it, so I was wondering if anyone knows of particularly good tutorials or tips which they can offer for building a good contact form with php. I'm finding the Sitepoint 'Build Your Own Database Driven Website' book uncharacteristically hard to grapple with compared to the one for XHTML and CSS.