im no php expert like some of the other guys on this board will be, but the undefined variable error is more likely caused where you're using a variable ($test) that hasnt been set yet. in most languages this is just due to poor coding... in php you dont generally define variables (at least at the levels ive written at!), but before you can do things like comparisons (eg if $test > 10) you need to assign it a value first
You might want to take out warnings too, those caused troubles for me on a few scripts as well, similar type of things to the notices, not a critical failure, but do show up and stop further execution.
Sarcasm, the 6th Ponyman of the Apocalypse.
Please do not inquire about Tim, the 5th Ponyman.