Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Forked from aaronpk/gist:966720
Created May 11, 2011 15:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismatthieu/966727 to your computer and use it in GitHub Desktop.
Save chrismatthieu/966727 to your computer and use it in GitHub Desktop.
Email beta signup form saved to Google Docs
<!-- Put this in a file called post.php -->
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://spreadsheets.google.com/formResponse?formkey=your-google-form-key');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'entry.0.single' => date('Y-m-d H:i:s'),
'entry.1.single' => $_POST['email'],
'entry.2.single' => $ref,
'pageNumber' => 0,
'backupCache' => '',
'submit' => 'Submit'
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($ch);
?>
<!-- In your splash page, add the below -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<input type="text" id="email" />
<input id="btnSubmit" type="button" value="Beta Invite" />
<script type="text/javascript">
$(function(){
$("#btnSubmit").click(function(){
if ($("#email").val() != "") {
$.post("/post.php", {
email: $("#email").val()
}, function(data){
$("#emailBox").fadeOut("slow", function(){
$("#emailBoxConfirm").fadeIn("fast");
});
}, "json");
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment