如何在表单提交后禁用4个单选按钮中的一个单选按钮在php中
使用jquery
$(document).ready(function(){
//when you submit the form
$(".submitbutton").click(function() {
$.ajax(function{
type="POST",
url:"thefile.php",
data:"name="+name+"&email="+email.......
success:function(response){
$('.radio3').attr('disabled', 'disabled');
}
});
});
}); //end of (ready)
在不是的PHP中,我认为是个好主意
//submit form get the data etc...
$buttons = array("button1" => 0, "button2" = 1);
//displaying the buttons
foreach($buttons as $key => $but){
if($but == 1){
echo "<input type="radio" name='" . $key . "' disabled='disabled'/>"
}else{
echo "<input type="radio" name='" . $key . "' />
}
}
<input type="radio" name="xy" <? echo 'disabled="disabled"'; ?> />