PHP Redirect to another page (using Stripe) -


good day,

i using stripe collect payments site. have code working accept payments, having trouble redirecting user thank page once subscribed.

here have:

<?php get_header(); ?> <?php require_once('/home4/threehs/public_html/wp-content/themes/nofuss/config.php');  if ($_post) {     stripe::setapikey($stripe['secret_key']);     $error = '';     $success = '';     try {             if (!isset($_post['stripe_token']))             throw new exception("the stripe token not generated correctly");         $customer = stripe_customer::create(array(             "email"=>$_post['stripeemail'],             "card" => $_post['stripe_token'],             "plan" => 'yearly' ));              $success = 'here want redirect thank page';     }     catch (exception $e) {         $error = $e->getmessage();     }            }  ?>  html signup form here 

this code using stripe (and few tutorials). looks on success, either receive string or when try header redirect, returns error.

thanks

you can in many different ways, using location header common:

header('location: http://www.example.com'); exit; 

edit: forgot note exit intentional. should include after redirect in order stop processing , prevent sensitive information leaks (i.e. redirecting away admin page when user doesn't have privileges).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -