in your database, add a field to the very first position (before all entries)
have it called, ID or id or somehting you will know what it is..
have it auto increment
move the database insert between
function sendmail(){
MOVE DB INSERT HERE
$priority = 0; // Should the email be sent with priority? (0 = No, 1 = Yes)
directly after the insert, find the id that it just inserted, call it $ID or some such
then between here
Here are the contents of the form:<br><br>";
echo ' Your ID# is XYZ'.$ID.''; // ADD THIS LINE
foreach ($_POST as $key => $value){