Your post is a little confusing. If you mean to ask "can I found out which page brought me to the current php script" then you might have some luck looking at the predefined variable $_SERVER['HTTP_REFERER']
echo 'I am ' . $_SERVER['PHP_SELF'] . '<br>';
echo 'The page that brought you here is ' . $_SERVER['HTTP_REFERER'] . '<br>';
HTTP_REFERER will not always contain information. It depends on information voluntarily provided by the browser.
Also, I am not certain it would work properly with header('location: mypage.php') or not.