[英]how to edit a record in php using jQuery popup
I have the list of record i want to edit the record in popup when I click on the button of the record it is showing the 1st record in the popup not all the record i want to edit every record but it is not working 我有记录列表,当我单击记录的按钮时,我想在弹出窗口中编辑记录,它在弹出窗口中显示第一个记录,而不是我想编辑每个记录的所有记录,但它不起作用
this is my php code 这是我的PHP代码
<?php
error_reporting(0);
$conn = mysql_connect('localhost', 'root', '') or die("Can't Connect With Local");
$db = mysql_select_db('school') or die("Local DB Not Found");
$s = mysql_query("Select * from student");
while($sql = mysql_fetch_array($s))
{
echo'<div class="ammad">'. $sql["id"]."".$sql["Name"]."".$sql["Subject"].'</div>';
echo '<input ammad="'.$sql["id"].'" type="submit" class="abc" id="abc"/>';
}
?>
this is the popup html 这是弹出的HTML
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p></p>
</div>
</div>
and this is the script of my popup 这是我弹出窗口的脚本
<script>
var modal = document.getElementById('myModal');
var btn = document.getElementById('abc');
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#abc").click(function(){
var b = $(this).attr("ammad");
$(".modal-content").append(b);
});
});
</script>
You are using two scripts over same element 您正在同一元素上使用两个脚本
btn.onclick = function() {
$("#abc").click(function(){
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.