Any time you get the undefined index message it is because the variable you are making reference to has not been defined. Since the code is a little different on the page the error message should be different also, it should include the exact line number where this is occurring.
If the warning is referring to your $mthCost variable then this could occur any time that the session variable is not set or is empty, this $mthCost variable will not get a value. If you make reference to this variable anywhere on the page then you can get this error if the variable has not been defined.
If you are printing out the variable anywhere on the page you can add in a check to make sure it is set like this:
[php[
<?php echo isset($mthCost)?$mthCost:"" ?>
[/php]
This will print the value if it is set, otherwise it will print nothing.
For starting the session you should make the check like this:
if(!session_id())session_start();