You need to set a cookie for this. You can then retrieve the cookie’s value on any page where you need it, or in the header.php
.
There are several ways you can do this, you can set cookies either via php or JavaScript.
Here is a good example on how to set a cookie with php in WordPress. For JavaScript, there are several options. There’s a jQuery cookie plugin, I recommend to google around for the different options.