Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it L'avatar di jepers
    Registrato dal
    Nov 2004
    Messaggi
    214

    aggiungere il ritorno al sito web dopo invio form

    Ciao, ho scaricato uno script per l'invio di email dal sito, l'ho scaricato qui sul html.it, nella sezione di php, è il primo.

    Io non conosco nulla di php, ma questo essendo molto semplice ho capito come fare quelle quattro personalizzazioni che mi servivano.

    Vorrei però aggiungere un ritorno al sito dop l'invio , cioè se l'invio della mail è andato si pare la pagina con i ringraziamenti, vorrei che lì sia visualizzato anche un link per tornare indietro al sito.
    Potete aiutarmi, grazie.

    Ecco il codice:
    Codice PHP:
    <?php
    $receiverMail    
    "your@email.com";

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

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

    // VALIDATION
    if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
        echo 
    "<h3>The email was not sent</h3>

    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>The email was not sent</h3>

    The email address is invalid</p>"
    ;
    }
    else {
        
    mail($receiverMail$subject$msgformat"From: $name <$email>");
        echo 
    "<h3>The email has been sent!</h3>

    I will get back to you as soon as possible.</p>"
    ; }
    ?>
    ed il form

    Codice PHP:
    <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" />


    Subject:
    <
    input name="subject" 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" />
    </
    form
    Est modus in rebus...

  2. #2

    Re: aggiungere il ritorno al sito web dopo invio form

    HTML

    echo "

    <a href=\"indirizzo_desiderato.ext\">Torna al Sito</a></p>";

    metti questo prima del "}?>" finale di send.php


  3. #3
    penso basti modificare l'ultimo echo aggiungendo una riga di html puro con il classico Torna alla homepage

    echo "<h3>The email has been sent!</h3>

    I will get back to you as soon as possible. Torna alla homepage</p>"; }

  4. #4
    Utente di HTML.it L'avatar di jepers
    Registrato dal
    Nov 2004
    Messaggi
    214
    Grazie a tutti e due ora provo.
    Est modus in rebus...

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.