What you search is a CAPTCHA ("Completely Automated Public Turing test to tell Computers and Humans Apart")
http://en.wikipedia.org/wiki/CAPTCHA

Here are some examples on how to realize a captcha with php
http://www.white-hat-web-design.co.u...hp-captcha.php
http://www.codewalkers.com/c/a/Misce...TCHA-with-PHP/
http://www.phpriot.com/d/articles/ph...m-2/page3.html
http://captcha.megaleecher.net/