include header page session error

I have a header page which includes navbar and necessary css's, js's.

I'm trying call the header page from contact page but there was something going wrong.

I take this error on the contact page.

  • Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:xampphtdocstestincludesheader.php:84) in C:xampphtdocstestcontact.php on line 3
  • following the contact page codes.

    <?php include_once ("includes/config.php");
    include_once ("includes/header.php");
    session_start();
    require_once'includes/phpmailer/security.php';
    ?>
    
    
    <div class="container">
        <div class="contact">
    
            <?php if(isset($_GET['CaptchaPass'])){?>
            <div >message sent</div>
            <?php } ?>
            <?php if(isset($_GET['CaptchaFail'])){?>
            <div >message failed</div>
            <?php } ?>
    
            <form action="includes/contact-config.php" method="post">
                <div class="form-group">
                    <label for="name">Your Name *</label>
                    <input type="text" name="name" autocomplete="off" required="" class="form-control" placeholder="Enter Name"  <?php echo isset ($fields['name'])? 'value="'.e($fields['name']).'"':''?>>
                </div>
                <div class="form-group">
                    <label for="email">Your Email address * </label>
                    <input type="email" name="email" autocomplete="off" required=""  class="form-control" placeholder="Enter Email"<?php echo isset ($fields['email'])? 'value="'.e($fields['email']).'"':''?>>
                </div>
                <div class="form-group" >
                    <label for="message">Your Message *</label>
                    <textarea class="form-control" rows="8" id="comment" required=""  name="message"<?php echo isset ($fields['message'])? e($fields['message']):''?>></textarea>
                    <br>
                    <div class="g-recaptcha" data-sitekey="6LcyfhgUAAAAAKunkwqqxFJSOPUzYbNmppLQbcWc"></div>
    
    
                    <input type="submit" value="Send" id="ContactButton" class="form-control" class="btn btn-primary">
                </div>
            </form>
    
        </div>
    </div>
    </body>
    
    <?php include ("includes/footer.php");?>
    

    header.php folder path--> C:xampphtdocstestincludesheader.php

    contact.php folder path --> C:xampphtdocstestcontact.php


    Most likely issue is that the includes/config.php or includes/header.php is outputting something to the browser - probably white space.

    If these files have a closing PHP tag ?> , removing them should help solve the issue. Also make sure none of the files are using echo or print or other output functions.

    链接地址: http://www.djcxy.com/p/69716.html

    上一篇: 电子邮件提交表单无效

    下一篇: 包括标题页会话错误