Created
May 11, 2011 15:48
-
-
Save aaronpk/966720 to your computer and use it in GitHub Desktop.
Email beta signup form saved to Google Docs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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