Hi Ilan,
Please say a little bit more about the problem:[list]
Is it creating the id?Or making sure it's uniqueOr showing it on the thank you page?[/list]
ChronoForms creates a unique id for every record saved in the database - but it's a bit long and not memorable e.g. uid = IM2I1NmJlYjRmYjMx There's also a record is 1,2, 3 . . . etc. which is simpler but not good to use as it leaves the possibility tha someone will try to get records based on guessing the sequence.
Here's a function that I wrote for an application to generate short id numbers using a pattern - the defult is AA9999A so you get results like CF3672G which are readable.
/*
* function to generate a random alpha-numeric code
* using a specified pattern
*
* @param $pattern string
*
* @return string
*/
function generateCvIdent($pattern='AA9999A')
{
$alpha = array("A","B","C","D","E","F","G","H",
"J","K","L","M","N","P","Q","R","S","T","U","V","W",
"X","Y","Z");
$digit = array("1","2","3","4","5","6","7","8","9");
$return = "";
$pattern_array = str_split($pattern, 1);
foreach ( $pattern_array as $v ) {
if ( is_numeric($v) ) {
$return .= $digit[array_rand($digit)];
} elseif ( in_array(strtoupper($v), $alpha) ) {
$return .= $alpha[array_rand($alpha)];
} else {
$return .= " ";
}
}
return $return;
}
This has about 90m variants but there is still a chance of a duplicate so you'd need to run a check on the database to be absolutely certain.
To use a code like this - create it in the form html box, add it to the form in a hidden field, then use the hidden field name to display it in the email template or use an echo statement to show the value on the thank you page.
Bob