so the random code is not being generated.
Add the following code at line 1 of the registration page to turn error reporting on:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
i believe a php error may be occurring when the random code session is being set.