[英]how to show record in popup using php mysql
I want to show the record in the popup using PHP and MySQL. 我想使用PHP和MySQL在弹出窗口中显示记录。 it is showing only the last record in the popup I want to show the selected record
它只显示弹出窗口中的最后一条记录,我要显示所选记录
$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"/>';
$name=$sql["id"];
}
echo '
<div id="dialog" title="Basic dialog">
<input type="textbox" value="'.$name.'" />
</div>';
the dialog is my popup 该对话框是我的弹出窗口
<script type="text/javascript">
$(document).ready(function(){
$(".abc").click(function(){
$( "#dialog" ).dialog().close();
var b = $(this).attr("ammad");
$( "#dialog" ).dialog();
});
});
</script>
It is showing only the last record in popup I want to show the selected record in the popup 它仅显示弹出窗口中的最后一条记录,我想在弹出窗口中显示所选记录
Just you doesn't update the diaglog box. 只是您不更新诊断对话框。
<script type="text/javascript">
$(document).ready(function(){
$(".abc").click(function(){
$( "#dialog" ).dialog().close();
var b = $(this).attr("ammad");
$("#dialog").html('<input type="textbox" value="' +b+ '/>');
$( "#dialog" ).dialog();
});
});
</script>
Try like this and remove { id="abc" } inside loop because id selectors must be unique. 像这样尝试并在循环内删除{id =“ abc”},因为id选择器必须唯一。
http://www.w3schools.com/cssref/sel_id.asp http://www.w3schools.com/cssref/sel_id.asp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.