I'd like to use Gravity Forms to post data to an external PHP script, located here: http://www.foothillunitycenter.org/forms/emaillistform/emailform.php, rather than use the existing form, because I do want to include some form validation here.
I found this discussion on the topic: http://www.gravityhelp.com/forums/topic/cant-find-any-instructions-to-post-form-data-to-external-url - which I think would pretty much resolve my issue, but I haven't been able to get it to work yet.
For what I want to accomplish, do I need to add any code to functions.php? IF so, would this code work:
add_action("gform_post_submission", "post_to_newsletter", 10, 2);
function post_to_newsletter($entry, $form){
if($form["id"] != 3) //NOTE: replace 3 with your form id
return;
?>
<form method="post" action="http://www.foothillunitycenter.org/forms/emaillistform/emailform.php" name="post_to_newsletter" id="post_to_newsletter">
<input type="text" id="name" name="Name" value="<?php echo $entry["name"] ?>" />
<input type="text" id="email" name="Email" value="<?php echo $entry["email"] ?>" />
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("post_to_newsletter").submit();
</script>
<?php
}
I did try it, and it didn't seem to do anything.
The other thing I tried was to setup a redirect in form settings. Under the confirmation tab, I entered the URL to the php form and then added teh following merge tags: name={Name:1}&email{Email:2} and that didn't seem to do the trick either.
If anyone could guide me to the right path, that would be rad.