That is exactly what you should do, storing this value in a session variable will ensure that you can get access to it in the email. Sometimes the scope of variables can be a tricky thing in php, but luckily using the session variables is easy way around this.