Originally posted by immot
You can select max(id) before insert-statement, and then insert max(id)+1. Now you know that the last id inserted is max(id)+1. In this way you must make sure that both select and insert are in the same transaction and that the transaction isolation level is serializable.
Do NOT use this approach! This can cause some major problems if you happen to have two or more users submitting the form at roughly the same time (which is very possible, when you cnsider the fact that litteraly millions of people have access to your page at any given time). At best, the last user would overwrite the data from the previous user(s), since they would both be using the same key. Your data and/or table could also become corrupted or worse! This method, while seemingly simple, presents some major data integrity, security, and stability issues! Again I say, do NOT use this approach!
PS: Nothing personal, immot, just making people aware of the potential consequences of your proposed method.