Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/wwwjjtex/public_html/contacts.php:2) in /home/wwwjjtex/public_html/contacts.php on line 2

AND my code is
margin-left: 94px;

    margin-top: -66px;

     margin-left: 94px;
    margin-top: -66px;
    max-width: 100%;"/></a></h1>
            <nav>
                <ul class="menu">
                        <li><a  href="index.php">home</a></li>
                        <li><a href="about_us.php">about as</a></li>
                        <li><a href="product.php">product</a></li>
                        <li><a href="<?php session_start(); if(isset($_SESSION['login_user'])){ echo "client_tree.php"; }else{ echo "clients.php";  } ?>"> clients </a></li>

                        <li><a class="active"  href="contacts.php">contacts</a></li>
                      <?php
                    if(isset($_SESSION['login_user'])){
                     echo "<li>";
                     echo "<a href='logout.php'>";
                     echo "Logout";
                     echo "</a>";
                     echo "</li>";
                    }
                    ?>
                    </ul>           
                 </nav>
            <div class="clear"></div>
        </div>
        <div style="margin: -9% 0 1% 86%;
    position: absolute;">
                    <a href="#"><?php if(isset($_SESSION['login_user'])){
                    echo "Wel come:";
                    echo $_SESSION['login_user'];
                    } ?></a>
                    </div>
        <div class="slider-wrapper">
            <div class="slider">
                <div class="banner">
                    <strong> <strong></strong></strong>
                    <em></em>
                </div>
            </div>
        </div>
    </header>



max-width: 100%;"/></a></h1>
        <nav>
            <ul class="menu">
                    <li><a  href="index.php">home</a></li>
                    <li><a href="about_us.php">about as</a></li>
                    <li><a href="product.php">product</a></li>
                    <li><a href="<?php session_start(); if(isset($_SESSION['login_user'])){ echo "client_tree.php"; }else{ echo "clients.php";  } ?>"> clients </a></li>

                    <li><a class="active"  href="contacts.php">contacts</a></li>
                  <?php
                if(isset($_SESSION['login_user'])){
                 echo "<li>";
                 echo "<a href='logout.php'>";
                 echo "Logout";
                 echo "</a>";
                 echo "</li>";
                }
                ?>
                </ul>           
             </nav>
        <div class="clear"></div>
    </div>
    <div style="margin: -9% 0 1% 86%;
position: absolute;">
                <a href="#"><?php if(isset($_SESSION['login_user'])){
                echo "Wel come:";
                echo $_SESSION['login_user'];
                } ?></a>
                </div>
    <div class="slider-wrapper">
        <div class="slider">
            <div class="banner">
                <strong> <strong></strong></strong>
                <em></em>
            </div>
        </div>
    </div>
</header>

Recommended Answers

All 3 Replies

This part session_start(); is done more than once, I see it on line 11 and 54 (might be even more, I didn't look further). It might also be done by parts above or below the part you posted. You can't do it more than once so remove all but the first occurrence (again, that also includes occurrences on other pages you may have included above or below the part you posted).

The session_start function must be called before any html is sent. Best place is on very top of the script:

<?php 
session_start();
?>
...
margin-left: 94px;
margin-top: -66px;
margin-left: 94px;
margin-top: -66px;
max-width: 100%;"/></a></h1>
...

See the PHP manual entry for the session_start function, especially the Notes part.

In short: session_start() should be called once only, at the top of the page, before any output is sent to the browser :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.