This is one of the most common mistakes developers (of any language) make so I thought I should let you know why you shouldn't use this method.
The Scenario:
You have a page on your site and you don't want people to simply link to this page unless they have clicked on a link from your own site. Lets say your page is called 'page2.php' and it's located at 'www.your-site.com/page2.php.'
When the user enters the 'page2.php' page you can easily determine which page they came from, in PHP you can use the $_SERVER['HTTP_REFERER'] function to determine the referring page. With this function you would check that it contains www.your-site.com in the value.
For what ever reason why you might want to check the referring address to your page, checking the referral address against your own domain name isn't bullet-proof.
Why? The referral address is set by the user's agent (their Internet browser), some browsers have the option for you to edit this value and some browsers don't even set this at all.
There are many solutions to this scenario, but I would recommend using sessions where you can set the a session variable on 'page1.php' which contains the link to 'page2.php.' When the user enters the 'page2.php' page, you can then check to see if that variable has been set, if it hasn't then the user must have come from a different location.
It's a little bit more of a setup, but it's secure.