Theoretically, you can query for the next id, generated by auto increment, see this How to get the next auto-increment id in mysql
However, remember that you have to do this within a transaction, where you lock the table before you query it, to prevent other processes from inserting and taking up the id that you just got. Have a look at https://dev.mysql.com/doc/refman/5.0/en/lock-tables.html
However, this is going to get really, really complicated really, really quickly. Are you sure there is no other way to solve this problem? Can't you update the name after the record has been saved, that would be tremendously more easy?