如何在使用PHP发送电子邮件后使div可见

时间:2017-01-24 22:49:36

标签: php forms

我的index.html文件中有以下联系表单

<div class="alert alert-success visible" id="successmsg"><strong>Success!</strong> Your message has been sent to us.</div>

 <form method="post" action="mail.php" class="contact-form">
          <div class="form-group">               
            <input type="text" class="form-control"  name="name" id="name" placeholder="Name">
          </div>
          <div class="form-group">                
            <input type="email" class="form-control" name="email" id="email" placeholder="Email">
          </div>
          <div class="form-group">               
            <input type="text" class="form-control"  name="subject" id="subject" placeholder="Subject">
          </div>              
          <div class="form-group">
            <textarea class="form-control" type="text" name="message" id="message" placeholder="Message"></textarea>
          </div>
          <div class="actions">
          <button type="submit" data-text="SUBMIT" class="button button-default"><span>SUBMIT</span></button>
          </div>
        </form>     

id“successmsg”使用简单的display:none;隐藏在HTML文件中。代码和当使用以下php

发送电子邮件时,我需要使其可见
<?php$name = $_POST['name'];

$email = $_POST['email'];

$message = $_POST['message'];

$subject = $_POST['subject'];

$formcontent=" Name:\r $name \n\n Email:\r $email \n\n Subject:\r $subject \n\n Message:\r $message ";

$recipient = "towersdvd@gmail.com";

$subject = "Website Contact";

$mailheader = "From: $email \r\n";

mail($recipient, $subject, $formcontent, $mailheader);


<style type="text/css">#lol{display:yes;}</style>
exit;}?>

这根本不起作用。有人可以帮助我吗?非常感谢您的帮助。提前致谢! :)

2 个答案:

答案 0 :(得分:1)

display属性没有任何'yes'值。请尝试将其更改为{display: block;}{display: inline;},具体取决于。

点击此链接了解详情:https://developer.mozilla.org/en-US/docs/Web/CSS/display

答案 1 :(得分:0)

我认为您正在使用/输入错误的ID

请更改<style type="text/css">#lol{display:yes;}</style>

&LT; style type="text/css">#successmsg{display:inline;}</style>

希望这会有所帮助。