[Solved]return/retrieve the uid

WhiteLighter01 18 May, 2012
Hi all,

I have a quick (newb) question. I'm using CFv3.2 and wondering how can I return/retrieve the uid of the record that has been inserted in the db? I'm planning to pass the uid to our payment gateway so that the payment gateway can retrieve the info from the db. When the user click on the submit button, they will be redirected to the payment gateway having all the fields pre-populated based on the info they have submitted using chrono forms.

Thanks
WhiteLighter01 18 May, 2012
After a few more poking around, instead of retrieving it, I decided to generate it and just pass it to the db and also to the payment gateway.

To generate the uid, I used the same code generated by the AutoGenerated Code and assign it to uid variable and use the value on a hidden field
<?php
$uid = "I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
?>
...
...
...
<input type='hidden' name='uid' value='<?php echo $uid; ?>' />


then I just append the uid on the URL query string
GreyHead 20 May, 2012
Hi WhiteLighter,

That should work OK.

Bob

PS There's an article here on generating a random identifier in ChronoForms 3.2 (you can ignore the barcode part).
This topic is locked and no more replies can be posted.