On the page that is the action in the form (<form action="thispage.php
">...) place your code.
If it is in the page in which the form is in then use the isset() function e.g.
Otherwise it will only be triggered when the form calls the action so the need for that security is less.
If this doesn't make any sense... Please can you post your HTML and PHP script.