0

actually, i want to display back all checked value in checkbox..In my form, there is some checkbox element where the user should check necessary value b4 submit the form....My problem is, once the user has submit the from, i can't retrieved only checked value.....it display all value including unchecked value in checkbox....so, if anyone can help me, it would be great....thanks in advance......

2
Contributors
1
Reply
5
Views
9 Years
Discussion Span
Last Post by Shanti C
0

Check this code:

<script>
function comparision(){
d=document.form2;
var total="";
if(!d.contype.length){
if(d.contype.checked) {
d.check_compare.value=d.check_compare.value+d.contype.value+',';
return true;
} else {
alert("Please select check Box");
return false;
}
}
for(var i=0; i < d.contype.length; i++){
if(d.contype[i].checked) {
#
total +=d.contype[i].value + "\n";
d.check_compare.value=d.check_compare.value+d.contype[i].value+',';
}
}

if(d.check_compare.value=="") {
alert("Please select atleast one check Box");
return false;
}
}
</script>

in the next page you should do like this:
$_POST;

And one more thing you have to add one hidden field like:
<input type=hidden name="check_compare" value="check_compare"> below your form tag starts....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.