Ciao ragazzi, premetto che con il PHP non ho dimestichezza, quello che riesco a smanettare arriva da una conoscenza generale sulla programmazione (vb).
Ora ho questo codice PHP:
codice:
<?php // L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
$to = "info@miosito.com";
// IL SOGGETTO DELLA MAIL
$subject = "Modulo proveniente dal sito";
// COSTRUZIONE DEL CORPO DEL MESSAGGIO
$body = "Contenuto del modulo:\n\n";
$body .= "Dati personali ;
nome: " . trim(stripslashes($_POST["nome"])) . "\n";
$body .= "cognome: " . trim(stripslashes($_POST["cognome"])) . "\n";
$body .= "Città: " . trim(stripslashes($_POST["citta"])) . "\n";
$body .= "Oggetto: " . trim(stripslashes($_POST["oggetto"])) . "\n";
$body .= "testo: " . trim(stripslashes($_POST["testo"])) . "\n";
$body .= "mail: " . trim(stripslashes($_POST["mail"])) . "\n";
// INTESTAZIONI SUPPLEMENTARI
$headers = "From: Modulo utenti<INDIRIZZO-COME-SOPRA>";
// INVIO DELLA MAIL
if(@mail($to, $subject, $body, $headers)) {
// SE L'INOLTRO E' ANDATO A BUON FINE...
echo "La mail è stata inoltrata con successo."; } else {
// ALTRIMENTI...
echo "Si sono verificati dei problemi nell'invio della mail."; }
?>
Con questa parte di html:
codice:
<form name="form1" method="post" action="mail.php"> <table width="95%" align="center" > <tr> <td colspan="2"><div align="center">CONTACT FORM</div></td> </tr> <tr> <td width="16%">Name</td> <td width="84%"><input type="text" name="nome"></td> </tr> <tr> <td>Surname</td>
<td><input type="text" name="cognome"></td> </tr> <tr> <td>City</td> <td><input type="text" name="citta"></td> </tr> <tr> <td>Your E-mail </td> <td><input type="text" name="mail"></td> </tr> <tr> <td>Subject</td>
<td><input type="text" name="oggetto"></td> </tr> <tr> <td>Type text</td>
<td><textarea name="testo" cols="40" rows="10"></textarea></td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" name="Submit" value="Submit"> </div></td> </tr> </table> </form>
Volevo chiedervi, come poter integrare 2 cose:
1) Controllo dei campi prima del'invio
2) Implementare un sistema antispam
Faccio questa domanda perchè come modulo mi sembra molto facile da usare (basta impostare un valore) e in rete non ho trovato nulla di altrettanto semplice. Grazie.