When de-bugging, it is good to know what variables are available at any one part of the script.
So I often echo out the variables, sometimes having them showing as html comments on the source of the page so as to not to disturb the page content.
```var_dump(get_defined_vars());' . htmlspecialchars(print_r(get_defined_vars(), true)) . ''; print '
' . htmlspecialchars(print_r($_SERVER, true)) . ''; ?>
(copying some old posts from an forum of mine that I wish to keep)