我想显示数据多选择复选框,并显示模式引导数据库中的数据?如何获取数据多复选框jquery show modal bootstrap
指数(PHP)
JavaScript代码
<script type="text/javascript">
$(document).ready(function()
{
$("#btnDetail").click(function()
{
$('#modalForm').modal('show').on('shown.bs.modal',function()
{
var data = $("#data").val();
$.post('page/user/detail_user.php',
{
id_data:$(this).attr(data)
},
function()
{
$('.modal-body').html(data);
});
});
});
});
</script>
数据用户
<table width="100%" border="1">
<tbody>
<tr>
<td width="3%" align="center"> </td>
<td width="97%" align="center">NAME</td>
</tr>
<?php
$qry = mysql_query("SELECT * FROM t_users");
while($data = mysql_fetch_array($qry))
{
?>
<tr>
<td align="center"><input type="checkbox" name="data[]" id="data[]" value='<?php echo $data['id']?>'></td>
<td><?php echo $data['name']?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<button id='btnDetail' name='btnDetail'>Detail User</button>
模态
<div class="modal fade" id="modalForm" name='modalForm' tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title blue" id="myModalLabel"></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
详细信息用户(PHP)
<?php
$id = $_POST['id_data'];
$qry = mysql_query("SELECT * FROM t_users WHERE id='$id'");
while($data = mysql_fetch_array($qry))
{
?>
<table width="100%" border="1">
<tbody>
<tr>
<th colspan='3'>
Detail Data Users
</th>
</tr>
<tr>
<td>ID</td>
<td>NAME</td>
<td>STATUS</td>
</tr>
<tr>
<td><?php echo $data['id']?></td>
<td><?php echo $data['name']?></td>
<td><?php echo $data['status']?></td>
</tr>
</tbody>
</table>
<?php
}
?>
场景:
当按钮详细信息用户在点击运行jQuery和值复选框,然后发送到模态引导,然后从jQuery的运行代码的PHP发布到显示模态引导数据库中的结果数据。
你能否简单地总结一下,说明什么可行,哪些不行。我很想知道你想要什么,但为了帮助别人的人,最好有(如果可能的话)明确的问题。 –
感谢您的帮助,我的问题是如何在数据库中显示数据到模态引导选中的复选框?,谢谢 –