Im not entirely sure that i understand what you are trying to achieve here.
You could set an hidden input on each page, so a post to the php page would make it clear from what page its comming in $_POST['var'].
You could put a get var in de url ( either
www.mysite.com/index.php?var or something similair ).
Only thing you then have to do is filter the desired var and assign its value to a variable in PHP.
From there you can you do your php magic.