As rpanning said, when you refresh a page, the variables that were set the last time you ran the script are no longer set. It starts from the very beginning. Because of this, you will have to specify your variables from either your URL or a session, as rpanning advised.
To refer to variables in the URL, use $GET['variable_name'] . To refer to variables in a session use $SESSION['variable_name'] .
If you want to use a session, as rpanning has said, you will have to have a session_start(); function at the top of your script as well as any other page that you wish to use the session variables. Also, a session will remain active, with the variables set, for an hour (iirc), or until the user closes their browser.
Take a look at http://www.php.net/manual/en/language.variables.php and http://www.php.net/manual/en/ref.session.php