It's not that simple.
you need to create an ipn page, the ipn page will page that the user never sees, on that page add processing to except the paypal ipn post, and then act according to the status of the post, success or failure.
Refer to the IPN Documentation i linked to previously.
Really with PayPal Standard, you cannot consider the transaction successful or failed til the IPN post is made. When the user reaches the checkout success page, the order status is pending.