on line 13 of code, getting null $nan value. if replace $_post['amount'] static integer, code post correct value. trying add little functionality, can't data pass???
http://i40.tinypic.com/34gxauw.png
<div id="container"> <?php require_once('stripe-php/lib/stripe.php'); $stripe = array( 'secret_key' => 'sk_07c5ukidqxydgfqikb8f7txqggyqt', 'publishable_key' => 'pk_07c58bhnzufyqr9auozd6scliwanw' ); stripe::setapikey($stripe['secret_key']); if ($_post) { $charge = stripe_charge::create(array( 'card' => $_post['stripetoken'], 'amount' => $_post['amount'], 'currency' => 'usd' )); var_dump($_post['amount']); $quotes = array( "thank purchase!", "enjoy experience with us!" ); echo "<h1>here's quote!</h1>"; echo "<h2>".$quotes[array_rand($quotes)]."</h2>"; } else { ?> <h2>tpc holdings</h2> <h3>select campaign package!!</h3> <form> <fieldset> <legend>select package</legend> <p> <label>select package</label> <input type = "radio" name = "amount[]" id = "sizesmall" value = "50" checked = "checked" /> <label = "sizesmall">$50.00</label> <input type = "radio" name = "amount[]" id = "sizemed" value = "75" /> <label = "sizemed">$75.00</label> <input type = "radio" name = "amount[]" id = "sizelarge" value = "large" /> <label = "sizelarge">$100.00</label> </p> </fieldset> </form> <form action="paybill.php" method="post"> <script src="https://button.stripe.com/v1/button.js" class="stripe-button" data-key="<?php echo $stripe['publishable_key']; ?>" data-amount="<?php echo $d_charge; ?>" data-description="tpc purchase" data-label="buy"></script> </form> <?php } ?> </div><!-- #container -->
don't make amount field array user select one these.
try this,
<p> <label>select package</label> <input type = "radio" name = "amount" id = "sizesmall" value = "50" checked = "checked" /> <label = "sizesmall">$50.00</label> <input type = "radio" name = "amount" id = "sizemed" value = "75" /> <label = "sizemed">$75.00</label> <input type = "radio" name = "amount" id = "sizelarge" value = "large" /> <label = "sizelarge">$100.00</label> </p>
Comments
Post a Comment