London12345
Programmer
I'm trying to pass Y or N to the database based on the checkbox selection but instead of Y or N "on" is being passed to the database and if nothing is checked then null is being passed instead of N .Please can you advise on this.
<html>
<head>
<!--<defanghtml_script type="text/javascript">
function handleChange(ids) {
var y=ids.id;
var z=y.length;
var aa="c"+y.charAt(z-1);
var name=ids.name;
alert(document.getElementById(aa).checked)
if(document.getElementById(aa).checked==true){
document.getElementsByName(name).value='Y';
alert( document.getElementsByName(name).value);
}
else{
document.getElementsByName(name).value='N';
alert( document.getElementsByName(name).value);
}
}
</defanghtml_script>-->
</head>
<body>
<defanghtml_input type="checkbox" name="cw" id="c1" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="li" id="c2" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="hw" align="middle" id="c3" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="dp" align="middle" id="c4" onclick="handleChange(this)"/>
</body>
</html>
<html>
<head>
<!--<defanghtml_script type="text/javascript">
function handleChange(ids) {
var y=ids.id;
var z=y.length;
var aa="c"+y.charAt(z-1);
var name=ids.name;
alert(document.getElementById(aa).checked)
if(document.getElementById(aa).checked==true){
document.getElementsByName(name).value='Y';
alert( document.getElementsByName(name).value);
}
else{
document.getElementsByName(name).value='N';
alert( document.getElementsByName(name).value);
}
}
</defanghtml_script>-->
</head>
<body>
<defanghtml_input type="checkbox" name="cw" id="c1" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="li" id="c2" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="hw" align="middle" id="c3" onclick="handleChange(this)"/>
<defanghtml_input type="checkbox" name="dp" align="middle" id="c4" onclick="handleChange(this)"/>
</body>
</html>