fritz.fx Posted January 16, 2009 Share Posted January 16, 2009 Hi all, I've been stuck on this little problem for a while. I have a form for recurring payments pointing to Paypal where people can select an amount, an interval (1,2,3, & so on) then a duration (weeks, months, years) then submit it. After all the jazz on Paypals site, they are redirected to a "thankyou page" where I insert the relevant data into a DB. My problem is, Paypal returns (to the thankyou page) everything except the interval and duration. How can I get Javascript to save those two on submit so I can use PHP to retrieve them after the Paypal page?? <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="business" value="<?php echo $paypal_email; ?>" /> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="return" value="http://www.the thankyou page.php" /> <input type="hidden" name="item_name" value="the item name"> <input type="hidden" name="currency_code" value="AUD"> <br /><input name="custom" type="text" class="donate_box_name" value="<?php echo $username; ?>" size="21" maxlength="40" /><br /> Donation amount<br /> <select name="a3" class="donate_box_amount"> <option>$5.00</option> <option>$10.00</option> <option>$15.00</option> <option>$20.00</option> <option>$25.00</option> <option>$30.00</option> <option>$40.00</option> <option>$50.00</option> <option>$75.00</option> <option>$100.00</option> <option>$125.00</option> <option>$150.00</option> <option>$175.00</option> </select><br /> Donation duration<br /> <select name="Duration"> <option value="5">1</option> <option value="5">2</option> <option value="5">3</option> <option value="5">4</option> <option value="5">5</option> <option value="5">6</option> </select> <br /> <select name="Interval"> <option value="W" selected="selected">Weeks</option> <option value="M">Months</option> <option value="Y">Years</option> </select><br /> <input type="image" src="btn_donate_LG.gif" name="submit" > </form I've tried a few things, but none of them are "just right" (One saves all the form fields to a cookie, bit it exceeds the max cookie length and I don't actually get the info I need. Another works just fine, but it saves the fields into a seperate cookie for each. (All in one would be better)).. Any help would be appreciated. I'm on the home stretch with this project and this problem has slowed me down a fair bit. Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 16, 2009 Share Posted January 16, 2009 Add an onSubmit event handler to your form that writes those values to the cookie example onload = function(){ var form = document.getElementById('form_id'); form.onSubmit = function(){ //write all of the cookie values in like 'key=value; key=value;' document.cookie = values; }; }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.