php - How to show a link if user_id =1 in HTML with PHP
问题描述
I am new and learning PHP and HTML. I have one user table where I am displaying data. I want to show Delete button if user_id = 1. else I want to hide it. My current link code is like below
<a href="<?php echo site_url('members/delete/'.$row['user_id']); ?>" class="btn btn-danger" onclick="return confirm('Are you sure to delete?')">delete</a>
I have done PHP code for doing achieve my above description
<?php
if ($row['user_id']==1){
echo //// I want a link here
}
?>
But since my link have also used some PHP codes, I am confused and not able to properly echo button. I am trying from an hour and not able to fix it. Let me know if someone can help me for do it.
Thanks!
解决方案
you can put html code in echo like this
echo "<tag name></tag name>"
推荐阅读
- c# - 使用 SignalR 从实时 SQL 更新数据时出现问题
- c++ - 在竞争编程指南书中解释“计算子网格的数量”解决方案
- javascript - 如何使用 typeof 字符串过滤掉键值对
- c# - 关于使用 ML.Net 识别名称的建议
- r - R regexp 用于对 char 向量进行奇数排序
- python - 使用 OpenCV Python 检测和计算两个图像之间不同像素的数量
- sql-server - SQL Server 存储过程的打字稿定义
- sql - 更改 SQL Server 中重复数据的值
- vba - 如何在 VBA 代码中按名称引用 Word 字段?
- excel - excel何时使用命名范围中的单个项目与所有项目?