HuuD Posted September 24, 2017 Share Posted September 24, 2017 HI, I hvae this code of php which shoes nothing in the div of bootstrap CSS, it shows empty div instead of text, any hints what I could be doing wrong. <?php if (isset($_SESSION['sesName'])) {/* THIS DIV IS CREATED IF THE SESSION EXISTS AND SHOULD SHOW THE USER NAME AND WELCOME MESSAGE BUT NOTHING HAPPENS echo '<div class="row"> <div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-4 col-md-offset-4"> <div class="panel-body"> <form role="form"> <fieldset> <div class="form-group">'; echo '<div class = "alert alert-success fade in">Welcome ' . $_Session['sesName'] . '"</div>'; '</div> </fieldset> </form> </div> </div> </div>'; } ?> <div class="row"> <div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-4 col-md-offset-4"> <div class="login-panel panel panel-default"> <div class="panel-heading">LOGIN</div> <div class="panel-body"> <form role="form" method="POST" action=""> <fieldset> <div class="form-group"> <input class="form-control" placeholder="E-mail" name="lemail" type="text" autofocus=""> </div> <div class="form-group"> <input class="form-control" placeholder="Password" name="lpass" type="password" value=""> </div> <div class="checkbox"> </div> <input type ="submit" class="btn btn-primary" value="LOGIN"> <input type ="button" onclick="location.href='registration.php'" class="btn btn-primary" value="REGISTRATION"> </fieldset> </form> </div> </div> </div> </div> Quote Link to comment Share on other sites More sharing options...
Barand Posted September 24, 2017 Share Posted September 24, 2017 You need to call session_start() if the page uses session variables. This should be called at the top of the code, before any output is sent to the browser. (I assume the invalid comment markup was only entered for our benefit and is not in your actual code) Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 24, 2017 Share Posted September 24, 2017 you have also mis-capitalized SESSION in the php variable usage. php variable names are case-sensitive. $_SESSION is not the same as $_Session. you would have been getting a php undefined variable error to help identify this problem. do you have your development system properly set up with php's error_reporting set to E_ALL and display_errors set to ON (preferably in the php.ini, so that you won't have to remember to set them) so that php will help you by reporting and displaying all the errors that it detects? Quote Link to comment Share on other sites More sharing options...
sumitkp Posted October 1, 2017 Share Posted October 1, 2017 include the bootstrap jquery library file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.