un codice che permetta di creare un form fatto bene per le richieste via mail?
Grazie a tutti :)
ciao,
vorresti fare una cosa tipo questa?
http://www.altuscany.it/book-lucca_eng.php
in tal caso il sorgente di quella pagina lo puoi vedere direttamente, ti metto il sorgente della seconda pagina che ti serve ovvero nel mio caso il file messaggio_email_eng.php
<html>
<head>
<title>
Message sent</title>
<meta http-equiv="Refresh" content="5;url=book-lucca_eng.php">
<meta name="robots" content="noindex, nofollow">
</head>
<body>
<?
if (!isset($_POST['emailaddr'])) {
header( "Location: book-lucca_eng.php" );
exit ;
}
if ((empty($emailaddr) || !ereg("@", $emailaddr)) || empty($name)) {
echo "<script type=\"text/javascript\">alert(\"ERROR: You must enter your name and a valid email address.\"); history.go(-1)</script>";
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $emailaddr ) ) {
echo "<script type=\"text/javascript\">alert(\"ERROR: Character invalid\"); history.go(-1)</script>";
exit ;
}
if (get_magic_quotes_gpc()) {
$name = stripslashes( $name );
$other = stripslashes( $other );
}
$messaggio .= "indirizzo ip: $REMOTE_ADDR \n";
$messaggio .= "lingua utilizzata: $lingua \n";
$messaggio .= "nome: $name \n";
$messaggio .= "periodo: $period \n";
$messaggio .= "numero adulti: $numadults \n";
$messaggio .= "numero bambini: $numchildren \n \n";
$messaggio .= "Testo del messaggio: \n";
$messaggio .= "$other";
$messaggio .= "\n";
$subject = "altuscany.it: $name ha inviato un messaggio";
$headers = "From:<$emailaddr>\n";
$headers .= "Reply-To:<$emailaddr>\n";
mail("
[email protected]", $subject, $messaggio, $headers);
?>
<br>
<br>
<br>
<br>
<br>
<div align="center">
<p><font size="3" face="Verdana">The message has been sent.</p>
</div>
</body>
</html>
Forse ci sono soluzioni più raffinate per quanto riguarda la sicurezza, ma senza andare su roba eccessivamente complessa penso che una cosa del genere vada benone. Anzi nel caso ci fosse qualcosa che non va fatemi sapere :p
Se ti servono informazioni più generali su questo tipo di form: http://www.google.it/search?hl=it&safe=off&client=firefox-a&rls=org.mozilla%3Ait%3Aofficial&hs=V4m&q=guida+form+email+post&btnG=Cerca&as_qdr=all&lr=&as_filetype=&meta=lr%3Dlang_it