-1

I got an error

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Web_app\nav.php on line 26

With this code

    <nav class="navbar navbar">`
    <div class="container-fluid">
    <div class="navbar-header">
    <a class="navbar-brand" href="#"></a>
    </div>
    <ul class="nav navbar-nav navbar-right">

    $_SESSION['client_id'] ='1';
>if client is not logged in
    //client login
    <?php 
    if(!isset($_SESSION['client_id']))
    { 
     ?>
    <li><a href="#"> Login</a></li>
    <?php} 

       else{?>
    <li><a href="#"> Edit Account </a></li>
    <li><a href="#"> My Account </a></li>
    <li><a href="#"> log out</a></li>
    <?php}?>
    </ul>
    </div>
    </nav>

I have configured the php.ini file but still can't solve the problem. Is there any syntax related problem?

chris85
  • 23,846
  • 7
  • 34
  • 51

2 Answers2

0

You can write $_SESSION['client_id'] ='1'; this inside php tag not and add white space in

Gohel Dhaval
  • 820
  • 1
  • 8
  • 12
0

You need whitespace after <?php for it to be recognized properly. So change

<?php}

to

<?php }

Also, the assignment

$_SESSION['client_id'] = '1';

needs to be inside <?php ... ?>, not in the HTML section.

Barmar
  • 741,623
  • 53
  • 500
  • 612