it should go after the paypal code.
your going to continue to get the undefined variable error untill you find out the correct variables names to use.
the code i gave will out put all of the variables that paypal passes over, it will show you what variable names Can be used.