JavaScript:
1) localStorage
(HTMl5 browsers only) - you could save it as a property of the page's local storage allowance
2) save it in a cookie
3) append the variable to the URL hash so it's retrievable via location.hash
after the refresh
PHP
1) save it as a session variable and retrieve it over AJAX each time the page loads
2) save it in a cookie (might as well do the JS approach if you're going to cookie it)
Any PHP approach would be clunky as you'd have to first send the value of the variable to a PHP script over AJAX, then retrieve it over AJAX after reload.