<?php
include("include/config.php");
$meta = 1;
$htmlMeta = '<title>ACSI - Comitato Provinciale di Padova | Collabora con noi</title>';
?>
<?php include('head.php'); ?>
<body>
<!-- wrap starts here -->
<div id="wrap">
<?php include('header.php'); ?>
<div id="sidebar" >
<?php include('tabellasx.php'); ?>
</div>
<div id="main">
<a name="TemplateInfo"></a>
<h1>Richiesta informazioni per affiliazione club</h1>
<?php
if($_POST) {
$date = date('Y-m-d');
$queryInsert = "INSERT INTO Sql97522_4.referente (idclub,nome,cognome,indirizzo,mail,tel,progetto,note,regdate) VALUES
('0','".$_POST['nome']."','".$_POST['cognome']."','".$_POST['indirizzo']."','".$_POST['mail']."','".$_POST['tel']."','".$_POST['progetto']."','".$_POST['note']."','".$date."')";
$resultInsert = mysql_query($queryInsert) or die (mysql_error());
// Configuro i dati di invio della mail
// (destinatario, mittente, oggetto e corpo)
$mail_to = "".$_POST['mail'].";segreteria@acsipadova.it";
$mail_from = "segreteria@acsipadova.it";
$mail_subject = "E' stato compilato il modulo di contatto Referente";
$mail_body = "Referente: ".$_POST['nome']." ".$_POST['cognome']."<br>";
$mail_body .= "Indirizzo: ".$_POST['indirizzo']."<br>";
$mail_body .= "Email: ".$_POST['mail']."<br>";
$mail_body .= "Tel: ".$_POST['tel']."<br>";
$mail_body .= "Progetto: ".$_POST['progetto']."<br>";
$mail_body .= "Note: ".$_POST['note']."<br>";
// Specifico le intestazioni per il formato HTML
$mail_in_html = "MIME-Version: 1.0\r\n";
$mail_in_html .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mail_in_html .= "From: <$mail_from>";
// Invio la mail
if (mail($mail_to, $mail_subject, $mail_body, $mail_in_html))
{
print "<p>Grazie, la richiesta di informazioni c stata inviata correttamente, verrai contattato da un nostro collabroatore nel piu breve tempo possibile.</p>Staff ACSI Padova";
}
} else {
?>
<FORM name="form" id="form" METHOD="POST" action="referente.php" onSubmit="return inviaForm()">
<p>
<label>Nome</label>
<input name="nome" type="text" id="nome" size="40">
<label>Cognome</label>
<input name="cognome" type="text" id="cognome" size="40">
<label>Indirizzo</label>
<input name="indirizzo" type="text" id="indirizzo" size="40">
<label>Progetto</label>
<input name="progetto" type="text" id="progetto" size="40">
<label>Telefono</label>
<input name="tel" type="text" id="tel" size="40" maxlength="40">
<label>Email</label>
<input name="mail" type="text" id="mail" size="40">
<label>Note</label>
<textarea name="note" cols="40" rows="5" wrap="virtual" id="note"></textarea>
<br />
<input type="submit" name="addreferente" value="Invia">
</p>
</form>
<?php } ?>
</div>
<?php include('tabelladx.php'); ?>
<!-- content-wrap ends here -->
</div>
<!-- footer starts here -->
<?php include('footer.php'); ?>
<!-- footer ends here -->
<!-- wrap ends here -->
</div>
<script language="JavaScript">
<!--
//verify for netscape/mozilla
function controllaForm(){
//DATI SOCIETA
nome=document.form.nome.value;
mail=document.form.mail.value;
messaggio=document.form.note.value;
tel=document.form.tel.value;
if (nome=="") {
alert("Attenzione!! Non e' stato inserito un nome di riferimento");
return false;
}
else if (mail=="") {
alert("Attenzione!! Non e' stato inserito un indirizzo email");
return false;
}
else if (tel=="") {
alert("Attenzione!! Non e' stato inserito un recapito telefonico");
return false;
}
else if (messaggio=="") {
alert("Attenzione!! Non e' stato inserito un messaggio");
return false;
}
else
return true;
}
function checkEmail() {
if(document.form.mail.value!=""){
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form.mail.value)){
return (true)
}
alert("L'indirizzo email inserito non c valido! Si prega di riprovare.")
return (false)
}
}
function inviaForm(){
if(controllaForm() && checkEmail()){
document.form.submit();
} else {
return false;
}
}
//-->
</script>
</body>
</html>