Getting PHP errors to show inside a lightbox

I used this code to turn on my error messages:


When I first launch my lightbox it shows me some warnings including some undefined variables. When I fill out the form inside the lightbox and go to the next page within the same lightbox, all I get is empty white. How do I get it to display the errors in the lightbox after I have submitted the info in the form?


The warnings are vanishing because once the form has been filled in, there is a value/content for each form field