Fixed problem with php notices. Added if(isset) to all elements.