GF staff,
I love this plugin and it has made my life a lot easier however it is very frustrating that there are code snippets floating all over the forums and the documentation page is very bare. Is there any way you can make it a priority to organize your code snippets (which are extremely helpful to the non-programmers) in a wiki or on the documentation page? Otherwise its almost impossible for beginners to use all of the amazing options without examples. Thanks guys.
For instance this code snippet relating to post form submission:
add_action("gform_post_submission", "post_to_paypal", 10, 2);
function post_to_paypal($entry, $form){
if($form["id"] != 3) //NOTE: replace 3 with your form id
return;
?>
<form method="post" action="http://paypalURL" name="form_to_paypal" id="form_to_paypal">
<input type="hidden" name="name" value="<?php echo $entry["1"] ?>" />
<input type="hidden" name="email" value="<?php echo $entry["2"] ?>" />
<input type="hidden" name="phone" value="<?php echo $entry["3"] ?>" />
NOTE: $entry["1"] will return field with ID=1. You can view the field ID by inspecting that input's markup
.... add your other fields here
</form>
<script type="text/javascript">
document.getElementById("form_to_paypal").submit();
</script>
<?php
}
This could temporarily solve the PayPal dilemma a lot of people are having so long as they don't need ipn. Just my two cents.
Oh this is the default paypal submission form. Just tailor the form above to include the values you need/want.
<FORM ACTION="https://www.paypal.com/cgi-bin/webscr" METHOD="POST">
<INPUT TYPE="hidden" NAME="cmd" VALUE="_xclick">
<INPUT TYPE="hidden" NAME="business" VALUE="recipient@paypal.com">
<INPUT TYPE="hidden" NAME="undefined_quantity" VALUE="1">
<INPUT TYPE="hidden" NAME="item_name" VALUE="hat">
<INPUT TYPE="hidden" NAME="item_number" VALUE="123">
<INPUT TYPE="hidden" NAME="amount" VALUE="15.00">
<INPUT TYPE="hidden" NAME="shipping" VALUE="1.00">
<INPUT TYPE="hidden" NAME="shipping2" VALUE="0.50">
<INPUT TYPE="hidden" NAME="currency_code" VALUE="USD">
<INPUT TYPE="hidden" NAME="first_name" VALUE="John">
<INPUT TYPE="hidden" NAME="last_name" VALUE="Doe">
<INPUT TYPE="hidden" NAME="address1" VALUE="9 Elm Street">
<INPUT TYPE="hidden" NAME="address2" VALUE="Apt 5">
<INPUT TYPE="hidden" NAME="city" VALUE="Berwyn">
<INPUT TYPE="hidden" NAME="state" VALUE="PA">
<INPUT TYPE="hidden" NAME="zip" VALUE="19312">
<INPUT TYPE="hidden" NAME="lc" VALUE="US">
<INPUT TYPE="hidden" NAME="email" VALUE="buyer@domain.com">
<INPUT TYPE="hidden" NAME="night_phone_a" VALUE="610">
<INPUT TYPE="hidden" NAME="night_phone_b" VALUE="555">
<INPUT TYPE="hidden" NAME="night_phone_c" VALUE="1234">
<INPUT TYPE="image" NAME="submit" BORDER="0" SRC="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" ALT="PayPal - The safer, easier way to pay online">
<img alt="" border="" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</FORM>
All you paypal people out there. Enjoy.