Your code as posted here worked OK for me (after I added the aforementioned "$" and the missing closing quote and semi-colon of the last line). Perhaps you should copy-and-paste the exact source code here that you are using for that section? (I note that in the above snippet, you include the array key $email in your foreach expression, but do not use it anywhere?)