about the line 40 error, it means you're trying to do something with a number that doesn't exist. Like this:
PHP Code:
<?php
$num += 1; // this adds 1 to $num
?>
now, the problem with this, is $num doesn't have a value, how can you add 1 to NULL? you can't. PHP assumes it's 0, and carries on. You are only seeing the error because you have your error_reporting up on E_ALL (more than likely E_ALL).
Make sure you have something like this:
PHP Code:
<?php
$num = 0; // this initializes $num with a value of 0
$num += 1; /* now you have something to add too (0) you have no error */
?>
hope this helps!
- Davey