Ciao, ho riscritto il codice che allego ma non riesco a far funzionare ne i controlli sui campi ne l'invio...
Qualcuno mi può aiutare?
Grazie mille
FORM HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="./mail.php" method="POST">
<table border="0">
<tr>
<td>Nome</td>
<td><input type="text" name="Nome" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="Email" size="50"></td>
</tr>
<tr>
<td>Oggetto</td>
<td><input type="text" name="Oggetto" size="50"></td>
</tr>
<tr>
<td valign="top">Messaggio</td>
<td><textarea rows="8" name="Messaggio" cols="60"></textarea></td>
</tr>
<tr>
<td colspan="2" valign="bottom" align="center" height="30">
<input type="submit" value="Invia">
<input type="reset" value="Cancella"></td>
</tr>
</table>
</form>
</body>
</html>
SCRIPT PHP:
<?php
// L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
$to = "XXXXXXX@XXXXXXXXX.it";
// IL SOGGETTO DELLA MAIL
$subject = "CONTATTO DA XXXXXXXXX";
// COSTRUIAMO IL CORPO DEL MESSAGGIO
$nome=$_POST['Nome'] ;
$email=$_POST['Email'];
$oggetto=$_POST['Oggetto'];
$messaggio=$_POST['Messaggio'];
// INTESTAZIONI SUPPLEMENTARI
$headers = "From: Modulo utenti<XXXXXXXXX>";
// INVIO DELLA MAIL
if (empty($nome))
$error = true;
{
echo "Spiacenti, campo Nome vuoto!
";
}
if (empty($email))
$error = true;
{
echo "Spiacenti, campo Email vuoto!
";
}
if (empty($oggetto))
$error = true;
{
echo "Spiacenti, campo Oggetto vuoto!
";
}
if (empty ($messaggio))
$error = true;
{
echo "Spiacenti, Messaggio vuoto!
";
$error = true;
}
if
(!$error) {
mail($to, $subject, $nome, $email, $oggetto, $messaggio, $headers);// SE L'INOLTRO È ANDATO A BUON FINE...
echo "La mail è stata inoltrata con successo.
";
}
?>