Chronoforms
RSSPosts: 2
Joomla Programmer 1.5: chronoforms and mod_php automatic form submit to paypal
Joomla Programmer
Getting a chronoforms form submission land on a paypal page which then automatically submits to paypal.
Chronoforms form membership includes field mtype. mtype contains a donation value for paypal. Submit the chronoforms membership mype to mod_php paypal form. Fill in the mod_php paypal form amount field with the mtype value. Automatically submit the mod_php paypal form to paypal. Automatically return to a thank you page.
- System cache settings must be off to garner $_POST['value']s. Otherwise you get cached values from previous submissions of chronoforms to mod_php.
- Create the mod_php paypal form. Place it in user position “membership_dues”
- create a content article, the text of which is: {loadposition membership_dues}
- In a dummy menu, create an Article layout menu item pointing to the membership_dues content. In this example the resultant address is index.php?option=com_content&view=article&id=31
- Chronoform membership form method must be POST. GET will screw up SEF links.
- Set the chronoforms FORM URL submit URL to:
- Do NOT have a form target (the default is target=”paypal”) in mod_php paypal form. This creates a popup condition which is quietly suppressed by any browser with popup blocker. It looks like the form submit is not working. Test in IE to see a better error message than in Firefox:
<form action=”https://www.paypal.com/en/cgi-bin/webscr” method=”post” name=”mform” id=”mform”> - Return the donator to your thank you page. Whether or not you tell PayPal to return a Post, it will return a GET. So create an HTML page for the return/thank you. If you put a Joomla page as the return, PayPal will send back garbage to index.php, and it will not redirect to the page you specify.
<input type=”hidden” name=”return” value=”http://fulldomainhere/thankyou.htm” /> - Fill in the PayPal amount from the submitted form via a POST variable in mod_php paypal form.:
- Do NOT name the submit button “submit” in mod_php paypal form. It clashes with the javascript form submit.
- auto submit the mod_php paypal form
<script language=”javaScript” type=”text/javascript”>
document.mform.submit();
</script>
http://fulldomainhere/index.php?option=com_content&view=article&id=31
<img src=”http://www.animalallies.org//images/stories/pawani.gif”><br>Amount $: <input type=”text” name=”amount” size=”4″ maxlength=”10″ value=”<?php echo $_POST['mtype']; ?>” style=”text-align:left;” />
<input class=”paybutton” type=”image” src=”http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif” name=”submitb” alt=”PayPal secure payments.” />
chronoforms membership application:
<h1>YourWebsite Membership Application</h1> <table> lots of other form values omitted for this example... <tr><td valign=top nowrap>Membership Type</td><td><table> <tr><td><input type=radio name=mtype value="15">Individual</td><td align=right>$15</td></tr> <tr><td><input type=radio name=mtype checked value="25">Friend</td><td align=right>$25</td></tr> <tr><td><input type=radio name=mtype value="50">Sponsor </td><td align=right>$50</td></tr> <tr><td><input type=radio name=mtype value="100">Patron</td> <td align=right>$100</td></tr> <tr><td><input type=radio name=mtype value="500">Benefactor</td> <td align=right>$500</td></tr> </table></td></tr> <tr><td colspan=2><input type="submit" value=" Submit "></td></tr> </table>
mod_php paypal form is positioned at membership_dues user position and assigned to “all” menus
<div style="text-align:left"> <h4>Thank You for Joining YourWebsite</h4> <strong>Please complete your membership payment here</strong> <form action="https://www.paypal.com/en/cgi-bin/webscr" method="post" name="mform" id="mform"> <input type="hidden" name="image_url" value="http://www.fulldomainhere/templates/rhuk_milkyway/images/logo.gif" /> <input type="hidden" name="cmd" value="_donations" /> <input type="hidden" name="business" value="yourpaypalemailhere" /> <input type="hidden" name="return" value="http://www.fulldomainhere/thankyou.htm" /> <input type="hidden" name="undefined_quantity" value="0" /> <input type="hidden" name="item_name" value="YourWebsite Membership" /> <input type="hidden" name="currency_code" value="USD" /> <input type="hidden" name="charset" value="utf-8" /> <input type="hidden" name="no_shipping" value="1" /> <input type="hidden" name="cancel_return" value="http://www.fulldomainhere/" /> <input type="hidden" name="no_note" value="0" /> <img src="http://www.fulldomainhere//images/stories/pawani.gif"><br>Amount $: <input type="text" name="amount" size="4" maxlength="10" value="<?php echo $_POST['mtype']; ?>" style="text-align:left;" /> <input class="paybutton" type="image" src="http://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" name="submitb" alt="PayPal secure payments." /> </form></div> <script language="javaScript" type="text/javascript"> document.mform.submit(); </script>