Witam,
Posiadam taki formularz: http://jsbin.com/eronag/2/edit
Wiem, że tam jest trochę błędów w js (50 :P) ale nie w tym rzecz. Chciałbym dodać kilka rzeczy typu ilosc pokoi itp.
Wiem jak to dodać w php, ale nie wiem co muszę zmienić w js.
Tutaj kod php:
<?php
$owner_email = "email"; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< tutaj wpisz adres email na który mają byc wysyłane maile
$headers = "From: ".$_POST["email"]."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit";
$subject = 'Wiadomość ze strony internetowej';
$subject = "=?utf-8?B?".base64_encode($subject)."?=";
$messageBody = "";
if($_POST['name']!='nope'){
$messageBody .= '
Imię i nazwisko: ' . $_POST["name"] . '' . "\n";
$messageBody .= '
' . "\n";
}
if($_POST['email']!='nope'){
$mailnadawcy = $_POST['email'];
$messageBody .= '
Email: ' . $_POST['email'] . '' . "\n";
$messageBody .= '
' . "\n";
}else{
$headers = '';
}
if($_POST['state']!='nope'){
$messageBody .= '
State: ' . $_POST['state'] . '' . "\n";
$messageBody .= '
' . "\n";
}
if($_POST['phone']!='nope'){
$messageBody .= '
Telefon: ' . $_POST['phone'] . '' . "\n";
$messageBody .= '
' . "\n";
}
if($_POST['fax']!='nope'){
$messageBody .= '
Fax: ' . $_POST['fax'] . '' . "\n";
$messageBody .= '
' . "\n";
}
if($_POST['message']!='nope'){
$messageBody .= '
Treść: ' . $_POST['message'] . '' . "\n";
}
if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
}
mail($owner_email, $subject, $messageBody, $headers);
?>