PHP doesn't work like Javascript might on the client browser, the server needs to execute all the PHP code once the page is retrieved by the user. What this simply means: all PHP has to be done at one time when the page is called, and you can't call specific things on "click" or "load" events.
But if you want something just as seamless, just create a small page:
session_destroy();
header("Location: http://www.myhome.com");
And that will destroy the session and send them quickly back to your homepage, and the user won't even know the difference.