php - User login show element -


this question has answer here:

i'm wanting show element when logged in user. , when not logged in hidden. php parse error: syntax error, unexpected '<'. please on , upfront

<?php   if ($_session['usrname'])  { <style type="text/css">#lah{ display:visible;} </style>  } else { <style type="text/css">#lah{ display:none; }</style>  }  ?> 

you blending php html. need either echo html or drop out of php while entering html.

try this:

<?php   if ($_session['usrname']) { ?>     <style type="text/css">#lah      <?php {  ?>      display:visible;      </style>      <?php      } }  else {  ?>    <style type="text/css">#lah  <?php { ?>     display:none;     </style>      <?php }  }   ?> 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -