You are basing the discount on a $_POST value, which will only exist when that form post occurs. The solution is to save that into the SESSION so it will be available on all subsequent pages. In the referenced code $_POST["tradediscount"] would be replaced with $_SESSION["tradediscount"].
Then you just have to save the value in the session when it is posted in the form.