0

当您单击“发送”电子邮件以提供一个显示“感谢您提供信息”的框时工作。1分钟后盒子再次上滑。

当我点击“发送”然后它只是向下但滑块没有以某种方式向上。

<div class="kontakt_box">
        <h3>Kontakt Mads Ørnfeldt Andersen</h3>
        <p>Kom i kontakt med Mads Ørnfeldt Andersen</p>
            <form action="#" method="post" name="kontakt_box">
                <label>Navn<br /><input type="text" name="navn" required title="Angive et Navn" class="new" placeholder="Navn"></label><br />
                <label>Efternavn<br /><input type="text" required title="Angive et efternavn" name="efternavn" class="new" placeholder="Efternavn"></label><br />
                <label>Email<br /><input type="email" required title="Angive en email!" name="email" class="new" placeholder="Email"></label><br />
                <label>Tekst<br /><textarea name="tekst" cols="35" rows="10" class="new" placeholder="Tekst til email"></textarea></label><br />
                <label><input type="submit" name="send" value="Send" class="new send_email"></label>
            </form>
            <?php
            if(isset($_POST["send"]))
            {
                $email_afsender = $mebe->email_afsender();
            }
            if($_SESSION["email_sendt"] == true)
            {
                echo "<div class=\"tak_email\">Tak</div>";  
            }
            ?>
    </div>

<script>
$('.send_email').click(function() {
  $('.tak_email').slideUp('slow', function() {
    // Animation complete.
  });
});
</script>

这是我的功能:

function email_afsender()
{
    $_SESSION["email_sendt"] = true;
    $fra = $_POST["navn"] . " " . $_POST["efternavn"] . "<" . $_POST["email"] . ">";
    $til = "jp@absb.dk";
    $emne = "Kontakt blabla.dk - " . $_POST["navn"] . " " . $_POST["efternavn"];
    $besked = $_POST["tekst"];

    //headers

    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=UTF-8\r\n";
    $headers .= "From: " . $fra . "\r\n";

    mail($til, $emne, $besked, $headers);

    $TargetPage = "/kontakt/";
    header('Location: ' . $TargetPage);
}
4

1 回答 1

0

您的代码无效。您没有在表单中指定操作文件并且要提交它?

于 2013-05-17T12:00:20.147 回答