.: Studio Yoga & Pilates :.
corsi di Yoga - corsi di Pilates - corsi Formazione Pilates
/*
// ################ INSTALLATION #################
1. open the .php file where you want to have the contact form in.
2. paste this whole code in there
3. adapt values in the config section below to your needs.
4. upload the file - that's it!
// ############## END INSTALLATION ###############
*/
// ################### CONFIG ###################
// CSS classes & styles
$class_txt = "text";
$class_inputbutton = "inputButton";
$class_inputline = "inputLine";
$class_inputfield = "inputField";
$style_inputline = "width:355px;";
$style_inputfield = "width:355px;";
// email
$target_address = "info@yogapilates.it";
$email_subject = "RICHIESTA INFORMAZIONI dal FORM";
// error messages
$err_name = "Prego inserire Nome.";
$err_surname = "Prego inserire Cognome.";
$err_phone = "Prego inserire Numero di Telefono.";
$err_msg = "Prego riempire il campo della richiesta informazioni.";
$err_email = "Prego inserire un valido indirizzo Email.";
// misc text
$msg_date = "Data";
$msg_company = "Compagnia/Scuola/Centro";
$msg_name = "Nome";
$msg_surname = "Cognome";
$msg_address = "Indirizzo";
$msg_city = "Città";
$msg_phone = "Telefono";
$msg_email = "Email";
$msg_answerby = "Reply by";
$txt_email = "Email";
$txt_phone = "Phone";
$txt_post = "Post";
$txt_send = "Spedire";
$txt_mandatory = "Invio";
$msg_request = "Richiesta";
$msg_indent = 11;
// messages
$txt_thankyou = "
Grazie per averci contattatoRisponderemo il prima possibile. Torna indietro |
";
$txt_error = "
Si è verificato il seguente errore:{errors}
|
"; // {errors} is replaced by the errors that occurred
// End configuration
function spaces($num, $fill=" "){
$foo="";
for ($i=0; $i<$num; $i++) $foo.=$fill;
return $foo;
}
function isValidEmail($addr){
if(eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr))
return true;
else
return false;
}
// start form evaluation
$error="foo";
if ($_REQUEST['do']=="send"){
$error=false;
if ($_REQUEST['name']=="") $error.="» $err_name
";
if ($_REQUEST['surname']=="") $error.="» $err_surname
";
if ($_REQUEST['fon']=="") $error.="» $err_phone
";
if ($_REQUEST['message']=="") $error.="» $err_msg
";
if (!isValidEmail($_REQUEST['email'])) $error.="» $err_email
";
if ($error===false){
$message="$msg_date:".spaces($msg_indent-strlen($msg_date)).date("d M Y, H:i", time());
if ($_REQUEST['firma']) $message.="\n$msg_company:".spaces($msg_indent-strlen($msg_company)).$_REQUEST['firma'];
if ($_REQUEST['name']) $message.="\n$msg_name:".spaces($msg_indent-strlen($msg_name)).$_REQUEST['name'];
if ($_REQUEST['surname']) $message.="\n$msg_surname:".spaces($msg_indent-strlen($msg_surname)).$_REQUEST['surname'];
if ($_REQUEST['adresse']) $message.="\n$msg_address:".spaces($msg_indent-strlen($msg_address)).$_REQUEST['adresse'];
if ($_REQUEST['ort']) $message.="\n$msg_city:".spaces($msg_indent-strlen($msg_city)).$_REQUEST['ort'];
if ($_REQUEST['fon']) $message.="\n$msg_phone:".spaces($msg_indent-strlen($msg_phone)).$_REQUEST['fon'];
$message.="\n$msg_email:".spaces($msg_indent-strlen($msg_email))."mailto:".$_REQUEST['email'];
$message.="\n\n".spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "=");
$message.="\n$msg_answerby ".$_REQUEST['kontakt']."!\n";
$message.=spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "=");
$message.="\n\n$msg_request:\n\n".$_REQUEST['message'];
mail($target_address, $email_subject, $message, "From: ".$_REQUEST['email']);
echo $txt_thankyou;
}else if ($error!==false) $error=str_replace("{errors}", $error, $txt_error);
}
if ($error!==false){
if($error!="foo") echo $error;
// form
echo "\n";
echo "
\n";
}
/*
######################### END Contact Form ##########################
#####################################################################
*/
?>