Arg, this is so annoying!
I've got a form with a textarea. On submit I use a piece of php to send the data of the form to my email adress. The other data is sending fine (input) but it doesn't send the textarea along!
This is de PHP:
parse_str($_POST['stuff']);
mail("name@myemailadress.nl", "Website formulier", $name, $email, $comments);
This is the code:
<form class="form" id="form" action="" method="POST" >
<p class="name">
<input type="text" name="name" id="name" placeholder="NAAM" >
</p>
<p class="email">
<input type="text" name="email" id="email" placeholder="E-MAILADRES" >
</p>
<p class="text">
<textarea name="comments" id="bericht" placeholder="BERICHT" ></textarea>
</p>
<p class="submit">
<input type="submit" id="versturen_knop" class="submitBtn" value="VERSTUREN" >
</p>
</form>
This is the code that changes the state of the submit button for 3 seconds (message send confirmation) and triggers the PHP
$(document).ready(function(){
$('#form').submit(function(event){
$('.submitBtn').attr('value','BERICHT VERSTUURD!');
setTimeout(function(){
$('.submitBtn').attr('value','VERSTUREN');
}, 2000);
var stuff = $('#form').serialize();
jQuery.ajax({
type: 'POST',
url: 'mail.php',
data:{ 'stuff':stuff, }
});
//Prevents form submission
return false;
});
});
I hope you can help!