现在我已经把它写出来了
<div class="row">
<div class="col-lg-12">
<table id="usertable" class="table table-bordered table-hover text-center">
<thead>
<th class="col-lg-1 text-center">User ID</th>
<th class="col-lg-4 text-center">Username</th>
<th class="col-lg-4 text-center">Password</th>
<th class="col-lg-2 text-center">Role</th>
</thead>
<tbody>
<?php
require('dbconnectmssql.php');
$sql = "select [User_ID],[user_decoded],[pass_decoded],[permission] from [rfttest].[dbo].[users]";
$query = sqlsrv_query ($conn , $sql);
if($query === false)
{die( print_r( sqlsrv_errors(), true));}
while($row = sqlsrv_fetch_array( $query, SQLSRV_FETCH_NUMERIC))
{
echo "<tr>";
foreach($row as $x => $a)
{
echo "<td>".$a."</td>";
}
echo "<td>";
echo "<a href='#' ><span class='glyphicon glyphicon-wrench' aria-hidden='true'></span></a>";
echo "<a href='usercontrol.php?del=$row[0]'>";
echo "<span class='glyphicon glyphicon-trash' aria-hidden='true'></span>";
echo "</a>";
echo "</td>";
echo "</tr>";
}
?>
</tbody>
/table>
</div>
</div>这都是关于查询并显示表中有多少用户。
我想做的另一件事是
我现在的想法是隐藏表单,点击编辑后弹出,比如我点击,然后用存储的数据记录弹出表单,用户可以编辑它并通过提交PHP文件保存它,然后重定向回这个页面。
类似于:Contain form within a bootstrap popover?帖子
<a href="#" id="popover">the popover link</a>
<div id="popover-head" class="hide">
some title
</div>
<div id="popover-content" class="hide">
<!-- MyForm -->
</div>但我还是想不出
任何解决方案--我只想要一些东西来编辑回音的特定记录
抱歉,我的英语不好
谢谢
发布于 2015-08-25 07:43:52
您可能希望为此使用AJAX。
这在我看来太痛苦了--如果它奏效了,谷歌就会删除页面上的所有用户:
}
echo "<td>";
echo "<a href='#' ><span class='glyphicon glyphicon-wrench' aria-hidden='true'></span></a>";
echo "<a href='usercontrol.php?del=$row[0]'>";
echo "<span class='glyphicon glyphicon-trash' aria-hidden='true'></span>";
echo "</a>";
echo "</td>";
echo "</tr>";
}它可以写成
} ?>
<td>
<a href='#' ><span class='glyphicon glyphicon-wrench' aria-hidden='true'></span></a>
<a class="del" href='#' data-userid='<?PHP echo row["User_ID"]; ?>'>
<span class='glyphicon glyphicon-trash' aria-hidden='true'></span>
</a>
</td>
</tr>
<?PHP } ?>然后
$(function() {
$(".del").on("click",function(e) {
e.preventDefault(); stop the page from reloading
var id=$(this).data("userid");
$.get("usercontrol.php?del="+id,function() {
alert(id + "deleted");
});
});
});编辑
.show()和.hide()弹出带有数据的表单$("form").on("submit",function(e) { e.preventDefault(); $.post("save.php",$(this).serialize(),function(data) { alert("saved"); $("#formDiv").hide() });});https://stackoverflow.com/questions/32198028
复制相似问题