Php 根据查询结果隐藏DIV或按钮
我试图根据会话中存储的值隐藏一个DIV或相关按钮(该会话在登录时收集用户数据)。例如,如果有人使用20的访问代码登录,我希望某些按钮被禁用、隐藏等。这是一个内部门户,初学者可以使用它,所以我觉得很简单。任何其他想法都是非常受欢迎的。我该怎么做 这是我目前的代码。我已经删除了帖子的样式属性。谢谢大家Php 根据查询结果隐藏DIV或按钮,php,sql,Php,Sql,我试图根据会话中存储的值隐藏一个DIV或相关按钮(该会话在登录时收集用户数据)。例如,如果有人使用20的访问代码登录,我希望某些按钮被禁用、隐藏等。这是一个内部门户,初学者可以使用它,所以我觉得很简单。任何其他想法都是非常受欢迎的。我该怎么做 这是我目前的代码。我已经删除了帖子的样式属性。谢谢大家 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/x
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>MK Diamond - Main Menu</title>
<style type="text/css">
</style>
</head>
<?php
include("session.php");
echo "<body style=\"background-attachment: fixed; background-image: url('img/background.jpg');\">";
echo "<div class=\"auto-style1\" style=\"height: 213px; width: 100%; float: left;\">";
echo "<span class=\"auto-style5\">";
echo "<span class=\"auto-style22\"><strong>This portal is for MK Diamond use ";
echo "only. Any and all access is monitored and controlled - unauthorized ";
echo "attempts will be investigated.</strong></span><br>";
echo "<img src=\"img/mk-logo.png\" height=\"185\" width=\"375\"/></span><br>";
echo "</div>";
echo "<div>";
echo "<table style=\"width: 65%\" align=\"center\" class=\"auto-style7\">";
echo "<tr>";
echo "<td class=\"auto-style21\" style=\"height: 24px\"></td>";
echo "<td class=\"auto-style21\" style=\"height: 24px; width: 25px;\"> </td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style18\" style=\"height: 24px\">";
echo "<input name=\"jobsbutton\" type=\"button\" value=\"M.S. Jobs Menu\" onclick=\"location.href='jobsmenu.php'\" style=\"width:160px; height: 35px\" /></td>";
echo "<td class=\"auto-style18\" style=\"height: 24px; width: 25px;\"> </td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo "<input name=\"ordersbutton\" ID=\"ordersbutton\" type=\"button\" value=\"B.V. Orders Menu\" onclick=\"location.href='ordersmenu.php'\" style=\"width: 160px; height: 35px\" />";
echo "</td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo " </td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo " </td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo " </td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo "</td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo "You are logged in as "; echo "$row[name]";
echo "</span> <a href=\"logout.php\">Logout</a></td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style23\" style=\"height: 24px\">";
echo "Security Class: "; echo "$row[acctype]";
echo "</td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo "<strong>Welcome to the Main Menu</strong></td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo " </td>";
echo "</tr>";
echo "<tr>";
echo "<td class=\"auto-style19\" style=\"height: 24px\">";
echo "<input name=\"Button1\" type=\"button\" value=\"Release Notes\" onclick=\"location.href='releasenotes.php'\" style=\"width: 160px; height: 35px\" />";
echo "</td>";
echo "<td class=\"auto-style19\" style=\"height: 24px; width: 25px;\">";
echo " </td></tr>";
echo "</table>";
?>
</div>
<div class="auto-style8">
</div>
</body>
</html>
MK钻石-主菜单
仅仅因为人们年纪大了,并不意味着他们不知道如何进入开发工具和取消隐藏/取消禁用按钮。。。如果($row[acctype]==20){echo”“;}
,则它们不需要在DOM中以开头。看看语法,它会使您的代码更整洁。无论这是做什么包括(“session.php”)
在将任何内容输出到呈现文档之前(即,如果它包含会话\u start()
),它应该放在脚本的最顶端。