this is backwards. there is no point assigning an identifier before the record is saved. If I visit the comment form I don't need an identifier until I have submitted the form. there is always the possibility of canceling, in which case no ID would be issued.
once submitted assign an ID and provide this as part of the email, or a link in the email to the ticket. this is a very common and standard approach to solving this problem.
if the ID needs to be human readable or has business meaning than a number, even sequential, would be the a simple solution. I would
also recommend this value not being the PK in the database. PK with business value are never a good idea.
if the ID is just to identify the issue than a GUID is the way to go. human don't have to read it and they are 99.999999...% unique.
...back to the question at hand....
there is no reason, or need, to generate an identifier before the information is submitted. it simply does not make sense.
Jason Meckley
Programmer
faq855-7190
faq732-7259