error_reporting(E_ERROR | E_WARNING | E_PARSE);
function show_form()
{
?>
* ???????? ????, ??????? ?????????? ?????????
}
function complete_mail() {
$empty_input[] = 'klausimas';
$empty_input[] = 'vardas_pavarde';
$empty_input[] = 'telefonas';
$empty_input[] = 'e-mail';
for ($i=0; $i", substr(htmlspecialchars(trim($_POST['input_name'][$i])), 0, 1000));
if(substr(htmlspecialchars(trim($_POST['check'][$i])), 0, 1) == 1) {
if(empty($_POST['input_name'][$i])) {
$sendemail = 'No';
echo '
?????????? ????????? ???? '.$empty_input[$i].'!';
}
}
}
if($sendemail == 'No') show_form();
$mess = '
klausimas:'.$_POST['input_name'][0].'
vardas_pavarde:'.$_POST['input_name'][1].'
telefonas:'.$_POST['input_name'][2].'
e-mail:'.$_POST['input_name'][3].'
';
// ?????????? ???? ?????? ??? ???????? ?????
// ???? ?? ?????? ??? ??????? - http://www.php-mail.ru/class.phpmailer.zip
require 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->From = ''; // ?? ???? email
$mail->FromName = ''; // ?? ???? ???
$mail->AddAddress('dana.vija@is.lt', 'dana.vija@is.lt'); // ???? - ?????, ???
$mail->IsHTML(true); // ?????????? ?????? ?????? HTML
$mail->Subject = 'Klausimas'; // ???? ??????
$mail->Body = $mess;
if($sendemail != 'No'){
// ?????????? ???? ??????
if (!$mail->Send()) die ('Mailer Error: '.$mail->ErrorInfo);
echo '???????! ???? ?????? ??????????.';
}
}
if (!empty($_POST['submit'])) complete_mail();
else show_form();
?>