From where comes that html ? it's not from the code above.
                  Cesar
                   2010-04-30 14:37:13
                
              It looks like whatever would happen if $_POST['Submit'] != 'generateexcel' happens anyway - somewhere before the code you've posted. You'll need to do an if-else to make sure that the normal html display code doesn't also run.