I have a form which passes the forn field values to an ajx script which then passes those values to php and they are they sent to an email address.
The problem i have is that the values are not showing and instead i get the word undefined.
Here is my ajax code.
$(document).ready(function(){
$('form.save').submit(function () {
var name = $(this).find('.name').attr('value');
var email = $(this).find('.email').attr('value');
var telephone = $(this).find('.telephone').attr('value');
// ...
$.ajax({
type: "POST",
url: "application.php",
data: "name="+ name +"& email="+ email +"& telephone="+ telephone,
success: function(){
$('form.save').hide(function(){$('div.success')});
}
});
return false;
});
});
Here is my form
<form action="" method="post" class="save">
<input type="text" name="name" id="name" clsss="name" value="" placeholder="Name"/>
<input type="text" name="email" class="email" value="" placeholder="Email"/>
<input type="text" name="telephone" class="telephone" value=""placeholder="Telephone"/>
<input name="certified" type="checkbox" value="" checked>I am a Certified sophisticated Investor
<input type="hidden" name="type" value="Certified sophisticated Investor">
<input type="submit" name="submit" class="button" value="Submit"/>
</div>
</form>
And then the php (There is no sanitation on the php code i am just trying to get the value and will then use better php code)
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
// mail
$msg = "$name $email $telephone";
$msg = wordwrap($msg,70);
mail("*************","Application",$msg);
&instead of this& emailuse this&email