2017-07-08 113 views
0
使用我的PHP来显示结果到我的网页

,我用做了一点的造型启用面板引导当PHP被执行,除非其隐藏

<div class="alert alert-success" role="alert"> 
     <?php  
     if(isset($_POST['submit'])){ //check if form was submitted 
     include "assets/backend/newsletter.php"; 
     } 
     ?> 
</div> 

即使不执行的PHP代码中,我可以看到空白面板。 我该如何摆脱?

回答

1

[图片供参考。] [1]我想在你们的情况下,这种方式使得更多的SENS那么什么是U在那里做:

<?php  
if(isset($_POST['submit'])){ ?> 
<div class="alert alert-success" role="alert"> 
<?php include "assets/backend/newsletter.php"; ?> 
</div> 
<?php}?> 

如果提交表单的面板会出现这样如果未提交,面板将不可见。

footer.php 
<div class="container"> 
    <div class="row"> 
    <?php  
     if(isset($_POST['submit'])){ 
      echo '<div class="alert alert-success" role="alert"> '; 
      include 'assets/backend/newsletter.php'; 
      echo '</div>'; 
     } 
     ?> 
    </div> 

<div class="container-fluid" style="background-color:#222222"> 
    <div class="row"> 
     <div class="container" style="margin-top:15px; 
      margin-bottom:15px"> 
      <div class="col-lg-4" style="color:#f3f6f9"> 
       <img src="images/pc%20logo.png" width="80px" height="80px"> 
       <h4 > 
        PLACEMENT 
        <cell style="font-weight:bold">CELL</cell> 
       </h4> 
       <p>Nehru Nagar, Ring Road <br>New Delhi <br> 
        Ph :(+91) 964 328 0581<br> 
        Email : [email protected] 
       </p> 
       <a href="https://www.facebook.com/pgdavplacements"> <img src="images/f.png" height="30px" width="30px" > 
       </a> 
       <img src="images/i.png" height="30px" width="30px"> 
       <img src="images/linkedin.png" height="30px" width="30px"> 
      </div> 
      <div class="col-lg-4" style="color:#f3f6f9; 
       padding-top:30px"> 
       <h4>Subscribe to Our Newsletter</h4> 
       <form action=" " method="post"> 
        <div class="form-group"> 
         <input class="form-control" type="text" 
          id="inputemail" name="email_newsletter" placeholder="Your Email ID"> 
        </div> 
        <input type="submit" name="submit" class="btn btn-default" value="subscribe"> 
       </form> 
      </div> 
      <div class="col-lg-4" style="color:#f3f6f9; 
       padding-top:29px"> 
       <h4>Links</h4> 
       <ol class="breadcrumb"> 
        <li><a href="index.php">Home</a></li> 
        <li><a href="aboutcell.php">About Cell</a></li> 
        <li><a href="">Registration</a></li> 
        <li><a href="contactus.php">Contact Us</a></li> 
       </ol> 
      </div> 
     </div> 

     <div class="container-fluid" style="background-color:#f3f6f9"> 
      <div class="row"> 
       <div class="container" style="padding-top:7px"> 
        <div class="col-lg-6 col-sm-12 col-xs-12">© All the Rights Reserved with Placement Cell</div> 
        <div class="col-lg-6 col-sm-12 col-xs-12" style="text-align:right"><a href="https://www.linkedin.com/in/bhanukrsingh/">Developed By Bhanu Singh</a></div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div></div> 

或该:

<div class="container"> 
    <div class="row"> 
    <?php  
     if(isset($_POST['submit'])){ ?> 
     <div class="alert alert-success" role="alert"> 
      <?php 
      include 'assets/backend/newsletter.php'; 
      ?> 
      </div> 
     <?php 
     } 
     ?> 
    </div> 

<div class="container-fluid" style="background-color:#222222"> 
    <div class="row"> 
     <div class="container" style="margin-top:15px; 
      margin-bottom:15px"> 
      <div class="col-lg-4" style="color:#f3f6f9"> 
       <img src="images/pc%20logo.png" width="80px" height="80px"> 
       <h4 > 
        PLACEMENT 
        <cell style="font-weight:bold">CELL</cell> 
       </h4> 
       <p>Nehru Nagar, Ring Road <br>New Delhi <br> 
        Ph :(+91) 964 328 0581<br> 
        Email : [email protected] 
       </p> 
       <a href="https://www.facebook.com/pgdavplacements"> <img src="images/f.png" height="30px" width="30px" > 
       </a> 
       <img src="images/i.png" height="30px" width="30px"> 
       <img src="images/linkedin.png" height="30px" width="30px"> 
      </div> 
      <div class="col-lg-4" style="color:#f3f6f9; 
       padding-top:30px"> 
       <h4>Subscribe to Our Newsletter</h4> 
       <form action=" " method="post"> 
        <div class="form-group"> 
         <input class="form-control" type="text" 
          id="inputemail" name="email_newsletter" placeholder="Your Email ID"> 
        </div> 
        <input type="submit" name="submit" class="btn btn-default" value="subscribe"> 
       </form> 
      </div> 
      <div class="col-lg-4" style="color:#f3f6f9; 
       padding-top:29px"> 
       <h4>Links</h4> 
       <ol class="breadcrumb"> 
        <li><a href="index.php">Home</a></li> 
        <li><a href="aboutcell.php">About Cell</a></li> 
        <li><a href="">Registration</a></li> 
        <li><a href="contactus.php">Contact Us</a></li> 
       </ol> 
      </div> 
     </div> 

     <div class="container-fluid" style="background-color:#f3f6f9"> 
      <div class="row"> 
       <div class="container" style="padding-top:7px"> 
        <div class="col-lg-6 col-sm-12 col-xs-12">© All the Rights Reserved with Placement Cell</div> 
        <div class="col-lg-6 col-sm-12 col-xs-12" style="text-align:right"><a href="https://www.linkedin.com/in/bhanukrsingh/">Developed By Bhanu Singh</a></div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div></div> 

测试的两种选项都干活;

+0

解析错误:语法错误,意外的文件末尾在C:\ xampp \ htdocs \ PlacementCell \ assets \ php \ footer.php上行 我收到一个错误。 –

+0

@Bhanusingh份额footer.php –

+0

我编辑我的答案和添加footer.php –