WordPress shortcode returns the data before

I try to make a form with shortcode.

Main plugin file:

form.php:

functions.php:

I place shortcode into the middle of website: <div class="wrap">[form]</div>

But after submitting I get <p>OK</p> before <!DOCTYPE html><html> instead of <div class="wrap"><p>OK</p></div>

What’s wrong? After a long googling I found something about buffers, so tried to add ob_start(); and ob_get_clean(); but no effect. 🙁