- Katılım
- 3 Temmuz 2013
- Mesajlar
- 202
- Tepkime puanı
- 0
- Puan
- 0
- Yaş
- 31
- Konum
- Fatsa
- Web sitesi
- www.ahmetcetinkaya.net
Arkadaşlar bir türlü çözemedim mail formu nu altta ki verdiğim kodu mesajın mail adresıme gelmesı olarak ayarlayabılecek olan var mı? Daha doğrusu mail adresımı nereye yazacağim?
PHP:
// --------------------------------------------------------
// Mail form
// --------------------------------------------------------
var submit = $('#submit');
submit.click(function(){ // when the button is clicked the code executes
var error = false; // we will set this true if the form isn't valid
var ths = $(this);
var input_name = $('input#name');
var name = input_name.val(); // get the value of the input field
if(name == "" || name == " ") {
error = true; // change the error state to true
}
var input_email = $('input#email');
var email_compare = /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/; // Syntax to compare against input
var email = input_email.val(); // get the value of the input field
if (email == "" || email == "") { // check if the field is empty
error = true;
}else if (!email_compare.variable(email)) { // if it's not empty check the format against our email_compare variable
error = true;
}
if(error == true) {
ths.text("Check your input");
return false;
}
var form = $('#ajax-form');
var data_string = form.serialize(); // Collect data from form
$.ajax({
type: "POST",
url: form.attr('action'),
data: data_string,
timeout: 6000,
error: function(request,error) {
if (error == "timeout") {
ths.text("Timeout");
}
else {
ths.text("Error");
}
},
success: function() {
ths.text("Message sent");
}
});
return false; // stops user browser being directed to the php file
}); // end click function
});