in reply to problems with global $1

When posting, place your code between <code>...</code> tags. See Writeup Formatting Tips for more information.