Kudose's suggestion sounds like what you're after.
I still don't know if you're completely understanding the issue here, though.
When you go to the URL for this page, the server parses and executes all PHP code. Since $POST['xclick'] doesn't exist at that point yet (nothing's been POST'ed anywhere), the if() statement fails and your code is skipped. Then the server sends the HTML page to your browser. When you submit the form in your browser, it submits to PayPal's site (as Kudose pointed out).
It doesn't matter where in the code you place the PHP if() statement - you could put it at the very bottom if you felt like it. The point is that all of the PHP code is executed by the server, the resulting HTML content is sent to the user's browser, and then the connection is severed. If you want to execute PHP code when a form is submitted, you'll either have to a) POST the form back to your server, b) since we're talking PayPal, you can use the callback URL Kudose mentioned above, or c) use some sort of AJAX (client-side) code on the page that makes a request to your server before submitting the form to PayPal's website.