Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2010
    Messaggi
    246

    un form mail più semplice ma che non mi funziona

    buonasera a tutti sto realizzando un form per mail ma incontro sempre problemi....questo è l'ultimo tentativo che non mi funziona lo stesso!

    pagina contact.php
    codice:
    <style>
    #send2 {
      display: none;
    }
    
    </style>
    
    </head>
    
    <body>
    
     <input type="hidden" name="invia_Dati" value="REMOTE_HOST,HTTP_USER_AGENT" />
    <form method="post" action="send.php">
     Name:
    <input name="name" type="text" size="30" maxlength="40" />
    
    
    Email:
    <input name="email" type="text" size="30" maxlength="40" />
    
    
    
    Object:
    <input name="object" type="text" size="30" maxlength="40" />
    
    
    Message:
    <textarea name="msg" cols="50" rows="6"></textarea>
    
    
    <input type="reset" value="Reset" /><input type="submit" value="Send" />
     <input type="text" id="send2" name="send2" />
    
    
    </form>
    pagina send.php


    Codice PHP:
    <?php
    $receiverMail    
    "x@x.it";

    $name        ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
    $email        ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
    $object    ltrim(rtrim(strip_tags(stripslashes($_POST['object']))));
    $msg        ltrim(rtrim(strip_tags($_POST['msg'])));

    $ip        getenv("REMOTE_ADDR");



    $name htmlentities($name);
    $email htmlentities($email);
    $object htmlentities($object);
    $msg htmlentities($msg);





    if(
    $_REQUEST['send2'] != '') {
      
    header("location: /");  /* se si entra qui dentro, spam! */
    }





    $msgformat    "From: $name ($ip)\nEmail: $email\n\n$msg";

    // VALIDATION
    if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
        echo 
    "<h3>La mail non è stata spedita / The email was not sent</h3>

    Prego riempi i campi richiesti / Please fill all the required fields</p>"
    ;
    }
    elseif(!
    ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {
        echo 
    "<h3>La mail non è stata spedita / The email was not send</h3>

    L'indirizzo mail non è valido / The email address is invalid</p>"
    ;
    }
    else {
        
    mail($receiverMail$subject$msgformat"From: $name <$email>");
        echo 
    "<h3>La mail è stata spedita! / The email has been sent!</h3>

    Risponderò al più presto possibile / I will get back to you as soon as possible.</p>"
    ; }
    ?>

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2010
    Messaggi
    246
    nessuno risce ad aiutarmi non riesco a far partire le mail
    ??????

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2011
    Messaggi
    762
    Prima dichiari $object ... dopo dichiari $subject ...

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 © 2024 vBulletin Solutions, Inc. All rights reserved.