If you want, you can get PHP to generate the images for you. Then you just need to store the strings in a $_SESSION variable.
http://www.white-hat-web-design.co.uk/articles/php-captcha.php provides info on how to generate a captcha, just remove the code that adds all the obfucstication (lines)!