Php 将值从表行复制到模式行
我已经编写了一个HTML表,显示了来自SQL数据库的用户信息Php 将值从表行复制到模式行,php,html,html-table,modal-dialog,Php,Html,Html Table,Modal Dialog,我已经编写了一个HTML表,显示了来自SQL数据库的用户信息 <table class="table table-hover"> <tr> <th>Username</th> <th>Password</th> <th>Role</th>> <th>Attribute</th> <
<table class="table table-hover">
<tr>
<th>Username</th>
<th>Password</th>
<th>Role</th>>
<th>Attribute</th>
</th>
<th>Ideas/Score</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<?php while($result=m ysqli_fetch_array($fetch)) { $usertoattrquery="SELECT * FROM usertoattr WHERE usertoattr.user_id=" .$result[user_id]; $attrfetch=mysqli_query($con,$usertoattrquery) or die ( 'could no connect with instructions'); echo "<tr><td>".$result[ "username"]. "</td><td>" .$result[ "password"]. "</td>
<td>" .$result[ "role"]. "</td><td>only for Eval</td><td>coming soon</td><td>
<a href='#editUser' role='button' class='btn' data-toggle='modal'>Edit</a> </td>
<td><button class='btn'onclick='deleteConfirm()'>Delete</button> </td></tr>"; } ?>
</table>
用户名
密码
角色>
属性
想法/分数
编辑
删除
您可以为每个
添加一个id(只需确保每个id都不同多个id都不正确!!)
然后让javascript使用该值(.innerHTML)在模式中设置输入文本的值 我认为您应该使用javascript来实现这一点
<div id="editUser" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<h3 id="myModalLabel">Edit User</h3>
User Name
<input type="text">
<br>User Password
<input type="text">
<br>User Role
<select>
<option>Evaluator</option>
<option>Observer</option>
</select>
<br>User Attribute
<select multiple>
<option>Economics</option>
<option>Software</option>
<option>Management</option>
</select>
<br>
<button class='btn btn-primary'>OK</button>
<button class='btn' data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>