Home >Web Front-end >HTML Tutorial >How to hide buttons from visitors on the front end and display them only after logging in_html/css_WEB-ITnose
I hope you can help me a lot
Only output the button after logging in, do not output if you are not logged in
Two methods, but the essence is the same;
1. Your back-end script language judgment, for example, after the user logs in, the user's number will be stored in the session, and after the user logs out, the session will be cleared, then in your On that page, just judge whether there is a value in the session. If there is a value, output your button, such as php
<?php // 若session里存在userno这个变量,且该变量不为空。则输出按钮 if(isset($_SESSION['userno']) && !empty($_SESSION['userno'])):;?><input type="button" value="发言" id="submit"><?php endif ?>
Control the visibility of the button by judging the login identity
There are many ways to do this, it depends on which method you want to use,
The front-end can use js to control the button's disably.
The back-end can also control whether to output the button, or control the display and hide attributes of the button.
Anyway, you didn’t explain it clearly, and others don’t know how to answer you