Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [AIUTO] Salve questo è il mio primo post e il mio primo codice php...avete gia capit!

    Salve mi serviva un script per email...ho trovato questo è lo modificato ma nn mi funziona! Vi prego di aiutarmi che sono disperato xD Confido in voi raga! Ecco qua i miei file


    HTML:
    <fieldset class="info_fieldset">
    <div id="fields">
    <form id="ajax-contact-form" action="js/html_form_send.php">
    <div class="span-8 form notopmargin">
    <input class="text" name="first_name" size="19" type="text" placeholder="Nome">
    <input class="text" name="last_name" size="19" type="text" placeholder="Congome">


    </div>
    <div class="span-8 form last notopmargin">
    <input class="text" type="text" name="email" placeholder="E-mail" />
    <input class="text" type="text" name="telephone" placeholder="Telefono" />


    </div>
    <div class="span-8 form">
    <input class="texts" type="text" name="subject" placeholder="Oggetto" />


    </div>
    <div class="span-16 form">
    <textarea class="text" name="comments" rows="5" cols="25" placeholder="Messaggio" ></textarea>


    </div>
    <div class="span-12 notopmargin">
    <input class="button" type="submit" name="submit" value="INVIA MESSAGGIO" />
    </div>
    </form>
    </div>
    </fieldset>



    PHP

    <?php
    if(isset($_POST['email'])) {

    // CHANGE THE TWO LINES BELOW
    $email_to = "info@contat.eu";

    $email_subject = "Form Contatti su Contat.eu";


    function died($error) {
    // your error code can go here
    echo "Siamo spiacenti ma c'è stato un errore

    ";
    echo $error."

    ";
    echo "La sua richiesta non è stata effetuata. Tornare indietro per riprovare

    ";
    die();
    }

    // validation expected data exists
    if(!isset($_POST['first_name']) ||
    !isset($_POST['last_name']) ||
    !isset($_POST['subject']) ||
    !isset($_POST['email']) ||
    !isset($_POST['telephone']) ||
    !isset($_POST['comments'])) {
    died('Siamo spiacenti ma ce stato un errore con il suo form!');
    }

    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $telephone = $_POST['subject']; // not required
    $comments = $_POST['comments']; // required

    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    if(!preg_match($email_exp,$email_from)) {
    $error_message .= ' Il suo indirizzo email risulta non valido!
    ';
    }
    $string_exp = "/^[A-Za-z .'-]+$/";
    if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'Il nome puo avere soltanto caratteri dalla A alla Z!
    ';
    }
    if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'Il cognome da lei iserito risulta non valido!
    ';
    }
    if(strlen($comments) < 2) {
    $error_message .= 'Il commento da lei inserito risulta non valido!
    ';
    }
    if(strlen($error_message) > 0) {
    died($error_message);
    }
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
    $bad = array("content-type","bcc:","to:","cc:","href");
    return str_replace($bad,"",$string);
    }

    $email_message .= "Nome: ".clean_string($first_name)."\n";
    $email_message .= "Cognome: ".clean_string($last_name)."\n";
    $email_message .= "Mail: ".clean_string($email_from)."\n";
    $email_message .= "Telefono: ".clean_string($telephone)."\n";
    $email_message .= "Telefono: ".clean_string($subject)."\n";
    $email_message .= "Commento: ".clean_string($comments)."\n";


    // create email headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    @mail($email_to, $email_subject, $email_message, $headers);
    ?>


    <?php
    }
    die();
    ?>



    O se mi aiutate vi do un bacio ! SERIO HELPATTEMI! dateci una controllatina perche a me dreamwaver nn segna manco errori... non ho mai usato il php

    HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE!

  2. #2
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE! HELP! PLEASE!
    Cercavi aiuto....?

    Io vedo un died da qualche parte.....

    Quale errore ti dà?
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  3. #3
    Scusa e grazie per la risposta, ero partito via.... Niente alla fine ho cambiato codice e ho risolto. Dopo un po di tuturial ho scritto uno io anche se piu semplice

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.