我有一个名为"details:"的提交按钮,还有一个每行都有单选按钮的表。选择单选按钮,然后点击我的详细信息按钮,我想弹出一个窗口。
我使用过这样的东西:我不确定我尝试的代码是否真的很可怜,但请帮帮我。我使用的形式是GET。这是我的单选按钮:
<input type="radio" name="ID" value="<?php echo $id; ?>" class="radioValue" />
这是我的提交按钮:
<input type="submit" name="details1" value="Details" id="btndetails" class="btn" />
<div id="notice">
<div class="pop">
<?php
if(isset($_GET['details1']))
{
if(isset($_GET['ID']))
{
$n=$_GET['ID'];
echo$n;
//do some sql queries with the id
}
else echo"Fail";
}
?>
</div>
</div>
我已经使用jquery来确保点击:
(function($)
{
$(function()
{
$('#btndetails').bind('click', function(e)
{
// Prevents the default action to be triggered.
if($('.radioValue').is(':checked'))
{
e.preventDefault();
$("#notice").css("display", "block");
}
else
{
<?php echo"Please select the radio button";?>');
}
});
});
})(jQuery);
div通知显示为:none;目前点击单选按钮+详细信息按钮,我得到一个弹出消息"失败"。如何在弹出窗口中获取单选按钮值?我的方法错了吗?我需要在php中获取radio值,这样我就可以使用它来检索我的数据库。我不想在弹出窗口中使用任何插件。我只想通过使用php、html、css来实现它。请帮帮我。
这可能是您的问题:
<input type="submit" name="details1" value="Details" id="btndetails" class="btn" />
<div id="notice">
<div class="pop">
<?php
if(isset($_GET['details1']))
{
if(isset($_GET['ID']))
{
$n=$_GET['ID'];
echo$n;
//do some sql queries with the id
}
else echo"Fail";
}
?> // the first problem I found is here
</div>
</div>
同时检查您的URL是否在query string
中获得id
参数