So the good news is we know where the problem is. Now the question is, "Why?".
Try sticking this at the top if the script that is failing, and let's see what $POST values -- if any -- are actually being received by the script:
<?php
// debug code, comment out or delete when done debuggning:
echo "<pre>".print_r($_POST, 1)."</pre>";
exit;
// end debug code
If there is data, make sure the array indexes match what you are using in your code, including upper-/lower-case letters.
If the $_POST data is empty, then the problem is either in the form that is submitting to this page, or something in the web server. (I suppose it could be something in the PHP installation, too, though I have no idea what that would be.)
If the $_POST data looks correct, then make sure you're not blowing it away somehow before those lines in question are executed (though based on the code you've shown so far I don't see where that would happen).