PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Can't find any instructions to post form data to external url

  1. Hi there

    I need to create a form that uses the http POST method - I cant find instructions how to do this. I was sure that Gravity forms could do this.

    The form i will be replacing is at http://www.mmchannel.com/contact-us

    Posted 14 years ago on Tuesday March 30, 2010 | Permalink
  2. What exactly are you trying to do?

    Gravity Forms posts to itself and stores the data. After it posts to itself you can tell it to redirect elsewhere, but it would do so via query string parameters rather than POST (so more like GET rather than POST).

    To do that you would:

    - Edit the form
    - Edit the Form Settings
    - Select the Confirmation tab
    - Choose Redirect as the confirmation type
    - Enter the address the form should redirect to
    - Check the "Pass Field Data..." checkbox
    - Build the query string using the form field variable drop down.

    To build the query string you would for example type in that box the query string and where you want the form field values output you would select that form field from the "Insert form field" drop down. This inserts a token that will output the field value.

    If you absolutely need to post data what you can do is use this redirect and redirect to a PHP page that parses this data via the query string and then posts it.

    The other option would be to use post submission API hook and post the data when the form is submitted, but that would require more PHP knowledge and how to use WordPress hooks.

    Posted 14 years ago on Tuesday March 30, 2010 | Permalink
  3. Hi there

    I have a CRM database (using ZOHO CRM) - I'm new to Gravity forms but not very good at PHP. The reason I want to do this in Gravity forms is because I need form validation to make sure someone enters an email address for example

    Initially I want to pass 8 fields to our CRM database
    First Name
    Last Name
    Email
    Mobile
    + 4 hidden fields for ZOHO

    the start of the Zoho form is ...
    <form action='http://crm.zoho.com/crm/WebToLeadForm' method='POST'>

    any tips would be appreciated ...

    thanks

    Damien

    Posted 14 years ago on Wednesday March 31, 2010 | Permalink
  4. Try the following code snippet. Place it in your theme's function.php file. I added some fields as an example, but you will need to add all others. Good luck!

    add_action("gform_post_submission", "post_to_crm", 10, 2);
    
    function post_to_crm($entry, $form){
        if($form["id"] != 3) //NOTE: replace 3 with your form id
            return;
        ?>
            <form method="post" action="http://crm.zoho.com/crm/WebToLeadForm" name="form_to_crm" id="form_to_crm">
                <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_crm").submit();
            </script>
        <?php
    }
    Posted 14 years ago on Wednesday March 31, 2010 | Permalink
  5. Hi Alex

    can you give me a pointer please ...

    I've got my form working ... except I cant get it to work with a checkbox ... do i need to do something different?

    here is my form http://www.mmchannel.com/contact-us

    here is the code im using

    // CRM ZOHO contact form
    add_action("gform_post_submission", "post_to_crm", 10, 2);
    
    function post_to_crm($entry, $form){
        if($form["id"] != 1) 
    
            return;
        ?>
            <form method="post" action="http://crm.zoho.com/crm/WebToLeadForm" name="form_to_crm" id="form_to_crm">
    		<input type='hidden' name='xxxxx' value=xxxxxxxxxxxxxx/>
    		<input type='hidden' name='xxxxxxxx' value=xxxxxxxxx/>
    		<input type='hidden' name='actionType' value=xxxxxxxxxxxx=/>
    		<input type='hidden' name='returnURL' value='http://www.mmchannel.com/thanks-for-contacting-us' /> 
    
    	    <input type="hidden" name="First Name" value="<?php echo $entry["4"] ?>" />
            <input type="hidden" name="Last Name" value="<?php echo $entry["3"] ?>" />
            <input type="hidden" name="Email" value="<?php echo $entry["8"] ?>" />
               <input type="hidden" name="Mobile" value="<?php echo $entry["6"] ?>" />
            <input type="hidden" name="Description" value="<?php echo $entry["11"] ?>" />
            <input type="hidden" name="Lead Source" value="<?php echo $entry["7"] ?>" />
            <input type="checkbox" name="Mailchimp-Newsletter" value="<?php echo $entry["12.1"] ?>" />
            </form>
            <script type="text/javascript">
                document.getElementById("form_to_crm").submit();
            </script>
        <?php
    }
    Posted 14 years ago on Thursday April 8, 2010 | Permalink
  6. and another seemingly dumb question .. what about multiple forms?

    do I just duplicate the code and put the new form number in?

    thanks

    d

    Posted 14 years ago on Thursday April 8, 2010 | Permalink
  7. I'm going to have Alex look at the code and respond, however as far as your question regarding multiple forms... yes you would basically duplicate the code and change which form id you are targeting.

    Posted 14 years ago on Thursday April 8, 2010 | Permalink
  8. To make the checkbox work, you still want to store the value in a hidden field.
    <input type="hidden" name="Mailchimp-Newsletter" value="<?php echo $entry["12.1"] ?>" />
    What I am not sure is what the CRM expects the value of this field to be. (True/False, Yes/No, 0/1)? Try the following and tweak the "true" and "false" values to see which one works.
    <input type="hidden" name="Mailchimp-Newsletter" value="<?php echo empty($entry["12.1"]) ? "false" : "true" ?>" />

    As far as multiple forms, you can just duplicate the code and change the appropriate form id and field ids.

    Posted 14 years ago on Monday April 12, 2010 | Permalink
  9. Hi there

    Well I spotted lots of bugs with their CRM system - for instance ... I even had the field name wrong! But now i know they want 'true' or 'false'


    Mailchimp Newsletter   :<input type='checkbox' name='LEADCF102' checked='true'/ >

    does this mean the new sample of your PHP code is what I use?

    also when I look at the PHP code you gave me and look at the source code for http://www.mmchannel.com/contact-us

    what field id should I use? 12? 12.1? 12_1?
    does it matter?

    thanks

    Damien

    Posted 14 years ago on Monday April 12, 2010 | Permalink
  10. From looking at your form you would use 12.1 like in Alex's example because that is the field id for the newsletter checkbox. His PHP code is what you should use, although he mentions you may need to play with the location of the true/false values in his code (ie. try swapping their order if it doesn't work).

    Posted 14 years ago on Monday April 12, 2010 | Permalink
  11. thanks for all your help :)
    going to make the last tests now ..

    damien

    Posted 14 years ago on Tuesday April 13, 2010 | Permalink
  12. Hi there

    my form stops working when I add this snippet of code to the functions.php

    <br />
    <input type="hidden" name="Mailchimp-Newsletter" value="<?php echo empty($entry["12.1"]) ? "false" : "true" ?>" /><br />

    I know that this is what zoho is expecting

    <br />
    <input type='checkbox' name='LEADCF102' checked='true'/ ><br />

    any ideas please?
    thanks
    Damien

    Posted 14 years ago on Wednesday April 21, 2010 | Permalink
  13. Damien,
    Could you please send your functions.php file to me? alex[at]rocketgenius.com.
    I will take a look at it and see what is causing the problem. At first glance, the code snippet above should work

    Posted 14 years ago on Wednesday April 21, 2010 | Permalink
  14. I am having the same issue. I am trying to do the same thing and discovered this post.

    I copied the same approach and just changed it for my Zoho Fields. I can not get it to feed anything to the CRM.

    The function is http://www.pastie.org/2091790 and the form is at http://webuyhouses856.com/

    Is there something I'm missing?

    Posted 12 years ago on Sunday June 19, 2011 | Permalink
  15. My example above works as far as integrating with Gravity Forms goes. But I am not sure if it has all the proper fields for Zoho.

    What I recommend is that you create a simple HTML page with a form that posts to Zoho. That way you can easily learn which fields are required and what their exact names and values need to be. After you have your HTML form working and feeding data to Zoho, try plugging that into Gravity Forms and see if you have better luck. If not, I will be glad to help.

    Posted 12 years ago on Monday June 20, 2011 | Permalink
  16. contigo
    Member

    Hi guys,

    I'm a wordpress noob, but I'm trying to accomplish a similar thing as above.

    I'm trying to implement a "send this canned message via SMS to the phone number the user enters" on our wordpress website. I've seen a few plugins that make use of Wordpress widgets, but we had a custom wordpress theme created that doesn't use the widgets. So, what I want is to create a Gravity form that simply allows the user to enter their phone number in a field, press submit, and then have the GF add the phone number to a pre-built URL and post that to the site behind the scenes, while showing the user a nice "thank you" message.

    The sample URL is below, and all I need is the syntax for the redirect to insert the phone number where I have X's below, and submit. The phone number must be 10 digits, no braces or dashes.

    http://smsgatewayurlgoeshere.com/SMSsend?PhoneNumber=XXXXXX&Message=TestMessage

    Any help would be appreciated!

    Thanks!

    Posted 12 years ago on Thursday September 8, 2011 | Permalink
  17. Just wanted to say thanks to everyone for their work on this post. I have been stuck for a while on getting similar functionality to work and this worked for me. (I am sending users to a hosted payment page after submitting the form IF they chose a specific option on the form)

    Cheers!
    Jon Paul

    Posted 12 years ago on Monday November 28, 2011 | Permalink
  18. We've ben working on at plugin to do this that uses the Zoho API rather then sending the data via email. Check out this url for info http://helpforwordpress.com/plugins/gravity-forms-to-zoho-crm/

    PS

    Posted 12 years ago on Wednesday December 14, 2011 | Permalink

This topic has been resolved and has been closed to new replies.