Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Last active December 18, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hilukasz/5765520 to your computer and use it in GitHub Desktop.
Save hilukasz/5765520 to your computer and use it in GitHub Desktop.
$('.questionFive').click(function(){
$.post("../mail.php", preSubmit())
});
// this returns a string
function preSubmit(){
var optionTexts = [];
$("section").each(function(){
var h2 = $(this).find("h2").text();
optionTexts.push(h2)
$("ol li", this).each(function() { optionTexts.push($(this).text()) })
optionTexts.push("\n")
});
var optionString = optionTexts.toString();
var splitText = optionString.split(",");
alert(splitText)
return {"mailstring":splitText};
}
<?php
if (isset($_POST['mailstring']) {
$mail = $_POST['mailstring'];
mail('lukasz@visualhero.com', 'My Subject', $mail);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment