Help needed regarding donation forms

sameer_mhatre512 22 Nov, 2008
Hello Admin,
I need to make a donation form in chronoforms to have people fill up data and donate amount via paypal .This is needed for a church website. Can you please let me know where and how to configure the form.

Following is the link of the site where you can see the form http://covenant.cooleytechnologies.com/index.php?option=com_chronocontact&chronoformname=contribute
Also i had attached the backup of the form.Also i am having the licenese for the chronoforms.

please help me with the same,

regards
Sameer
GreyHead 22 Nov, 2008
Hi Sameer,

You'll find a few examples of PayPal forms in the forums here if you search on 'PayPal'. It looks as though you may also need some code to work out the total to pay.

Bob
GreyHead 25 Nov, 2008
Hi sameer_mhatre512,

As you've found it won't work if you just use a Submit URL - the form redirects immediately, ChronoForms never sees the results and no data is saved.

Instead you have to build a PayPal URL in one of the OnSubmit boxes and set it so that ChronoForms redirects to PayPal URL *after* the data has been saved.

Bob
sameer_mhatre512 25 Nov, 2008
Hello Bob,
Thanks for the reply.can you please show me how to do it?

regards
Sameer
GreyHead 25 Nov, 2008
Hi Sameer,

Please see this post Note you will need to change some of the variable values in the URL to match your needs.

Bob
sameer_mhatre512 27 Nov, 2008
Hello bob,
I wasnt able to code it. can you please let me know what i need to put and where?

let me know
regards
Sameer
rwoody 05 Jan, 2009
I am soooo lost here. I am building a Donation form for a Not-for-profit organization (kids charity) I don't think I quite get what I need to do here. My form works beautifully - collects all the data etc.; however it never makes it to PayPal. As I said.. I must be just missing something here.

Here is my form code:

    <tr>
    <th valign="top" scope="col">KidStar 100 Links Donation <div align="left">
      <br />
      <br />
     
          <label for="textfield">
          <div align="left">First Name:
            <input name="fname" type="text" id="fname" accesskey="1" tabindex="1" size="30" />
            <label for="label6">Last Name</label>
            <input type="text" name="lname" accesskey="2" tabindex="2" id="lname" />
            <br />
	    <br />
          </div>
          </label>
      <div align="left">
            <label for="label">Address:</label>
            <input name="address" type="text" id="address" accesskey="3" tabindex="3"  size="50" />
            <br />
            <br />
            <label for="label2">City:</label>
            <input name="city" type="text" id="city" accesskey="4" tabindex="4" size="50" />
              
            <label for="label3">State: </label>
            <input name="state" type="text" id="state" accesskey="5" tabindex="5" size="5" />
            <br />
            <br />
            <label for="label4">Phone:</label>
            <input name="phone" type="text" id="phone" accesskey="6" tabindex="6" size="35" />
            <br />
            <br />
            <label for="label5">Email:</label>
            <input name="email" type="text" id="email" accesskey="7" tabindex="7" size="60" />
            <br />
            <br />
            <label for="textarea">Comments:</label>
            <textarea name="comments" cols="40" id="comments" accesskey="8" tabindex="8"></textarea>
          <br />
          <br />
            <label for="Submit">Click To Submit Your Donation:</label>
            <input type="submit" name="Submit" value="Submit" accesskey="9" tabindex="9" id="Submit" />
        <br />
      </div>
        </tr>
</table>


And then I have in On Submit code - after sending email: the following: (PayPal address' substituted)

<?php
/**
* Build PayPal URL & redirect
*/

// Variables are set in the $form_config array
$url  = $form_config['https://www.paypal.com/cgi-bin/webscr'];
$url .= "&business=".$form_config['donations@mysite.com'];
$url .= "&item_name=100links_donation";
$url .= "&item_number=1001";
$url .= "¤cy_code=USD";
$url .= "&amount=100.00";
$url .= "&custom=$userid";
$url .= "&return=".$form_config['http://www.mysite.com/thank-you.html'];
//$url .= "&return=".urlencode($form_config['paypal_return']);
// $url .= "&cancel_return=".$form_config['paypal_cancel_return'];
$url .= "&no_note=1";
$url .= "&no_shipping=1";
}
if ( $debug ) {
    echo "url: ";print_r($url);echo "<br />";
    echo "<br /><a href='$url'>Click to continue</a><br />";
} else {
    $rows[0]->redirecturl = $url;
}
?>


All that happens is when the user hits the submit button - it goes to the Thank you page and collects the data and saves it to the db. I also get the email, but they never make it to PayPal. Also this particular donation is a fixed amount $100.00 as you can see in the PayPal code. I'm not sure if that is correct either.

Please help.. 😢 this is a great charity and I'm trying to help them get this drive going by tomorrow and I'm just stuck.(all probono work)

Thank you!!
GreyHead 05 Jan, 2009
Hi rwoody,

Sorry, the code you used was pasted in a hurry and includes some parts that are not useful to you because the values were entered somewhere else. Here's a cleaned up version

Later :: buggy code sample removed - please see the one a couple of posts on!!

You'll need to check the PayPal docs to see if the donation amount should be 100 or 100.00.

Bob
rwoody 05 Jan, 2009
Thank you for responding to me. I've made the changes that you have indicated but still no joy. I've uploaded a backup of my form. When I submit the form, it merely takes me to my "Thank You" page"; however it does save all the data and sends me an email, but it never redirects to PayPal.

Please help me understand what I am doing or not doing that is preventing this from working.

The kids are depending on me and I'm failing them terribly.

Ruth
GreyHead 05 Jan, 2009
Hi rwoody,

Please try this version - I have had it working OK :-)
<?php
$url  = "https://www.paypal.com/cgi-bin/webscr";
$url .= "&cmd=_xclick";
$url .= "&business=100links@kidstar.org";
$url .= "&item_name=100links_donation";
$url .= "&item_number=1001";
$url .= "¤cy_code=USD";
$url .= "&amount=100.00";
$url .= "&custom=".$_POST['email'];
$url .= "&return=http://www.mysite.com/thank-you.html";
// $url .= "&return=some_url";
// $url .= "&cancel_return=some_url";
$url .= "&no_note=1";
$url .= "&no_shipping=1";
if ( $debug ) {
    echo "url: ";print_r($url);echo "<br />";
    echo "<br /><a href='$url'>Click to continue</a><br />";
} else {
    $rows[0]->redirecturl = $url;
}
?>
Please remove your ReDirect URL just in case it causes problems. If you turn DeBug on you will be able to see the URL and then click a continue link to go on to PayPal.

Bob
rwoody 05 Jan, 2009
Bob, you are an absolute sweetheart !! This works perfectly now. I've got all my data nicely in the db and we went right to PayPal!!!

Thank you so much!! Now I'm going to go dress up the form to make it pretty...LOL and they will be ready tomorrow to launch. This is such a great program.. if you get a moment go to the website http://www.kidstar.org and check it out!! Click the feed to hear the kids - and remember most of these kids are around 10 to 12 years old!!

Thanks again for your help

Ruth
rwoody 05 Jan, 2009
I just wanted you to know.. more as a thank you than anything else - I just bought a site license for this wonderful software and the wonderful help you provided me. I and the kids love you!!

Ruth
itchibahn 07 Apr, 2009
Hi Bob,

I've tried the code in DEBUG mode, and it displays the url properly and proceeds toPayPal on continue as displayed below.
But when DEBUG is off, all I get is my main homepage with blank content on sbumit. As if that line "$rows[0]->redirecturl = $url;" is not forwarding the URL.

Am I missing some configuration? I'm using the latest versions of Chrono and Joomla. My site http://maranathabiblechurch.us/getinvolved/donate2church.html form was generated using the wizzard, then added the code.



        * Form passed first SPAM check OK
        * Form passed the submissions limit (if enabled) OK
        * Form passed the Image verification (if enabled) OK
        * Form passed the server side validation (if enabled) OK
        * Form passed the plugins step (if enabled) OK
        * Emails data loaded OK
        * Form passed all before email code evaluation OK
        * Debug End

$_POST array: Array ( [amount] => 222 [item_name] => One time gift to Maranatha Bible Church [cmd] => _donations [business] => donations@maranathabiblechurch.us This e-mail address is being protected from spambots. You need JavaScript enabled to view it [no_shipping] => 0 [no_note] => 1 [currency_code] => USD [tax] => 0 [lc] => US [bn] => MBC-Donate_WPS_US [715c528adbacf72368fc59ad41a476bb] => 1 )

$_FILES array: Array ( )

url: https://www.paypal.com/cgi-bin/webscr&cmd=_xclick&business=donations@maranathabiblechurch.us&item_name=One-Time Gift&item_number=1001¤cy_code=USD&amount=50.00&return=http://www.maranathabiblechurch.us/index.php?&no_note=1&no_shipping=1

Click to continue
itchibahn 07 Apr, 2009
I was using RC3, so updated to RC4. My other normal forms are working fine. But now, the PayPal code entered into the "On Submit Code" before or after email send, doesn't seem to be executing. I tried clear the cache/history etc, but it's still not executing. Please help.
GreyHead 08 Apr, 2009
Hi itchibahn,

Hmmm . . . Max has done some major code refactoring in RC4 and a lot has changed.

I think - haven't had time to test yet - that to set the redirect url you need to do
$MyForm->formrow->redirecturl = $url;
instead of
$rows[0]->redirecturl = $url;

Bob
Max_admin 09 Apr, 2009
you may need to add this line of code first too:

$MyForm =& CFChronoForm::getInstance();


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.