quì invece ti posto il codice della pagina php che processa i dati provenienti dal form e li invia ad un indirizzo e-mail.
codice:
<?php // URL: www.freecontactform.com // Version: FreeContactForm Lite V1.2 // Copyright (c) 2010 Stuart Cochrane <stuartc1@gmail.com> // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. if(isset($_POST['Email_Address'])) { include 'lite_settings.php'; function died($error) { echo "Sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.
"; echo $error."
"; echo "Please go back and fix these errors.
"; die(); } if(!isset($_POST['Full_Name']) || !isset($_POST['Email_Address']) || !isset($_POST['Telephone_Number']) || !isset($_POST['Your_Message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $full_name = $_POST['Full_Name']; // required $email_from = $_POST['Email_Address']; // required $telephone = $_POST['Telephone_Number']; // not required $comments = $_POST['Your_Message']; // required $error_message = ""; $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"; if(!eregi($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.
'; } if(strlen($full_name) < 2) { $error_message .= 'Your Name does not appear to be valid.
'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.
'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Richiesta informazioni proveniente dal sito internet.\r\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Nome Cognome: ".clean_string($full_name)."\r\n"; $email_message .= "Email: ".clean_string($email_from)."\r\n"; $email_message .= "Numero telefonico: ".clean_string($telephone)."\r\n"; $email_message .= "Richiesta: ".clean_string($comments)."\r\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); header("Location: $thankyou"); ?> <script>location.replace('<?php echo $thankyou;?>')</script> <? } ?>