Im learning PHP and trying to print a message based on checkbox check and uncheck.but im getting only else part when im trying to check checkbox .here is the php code .Let me know where im going wrong.
<html>
<body>
<script type="text/javascript">
function on_callPhp()
{
if(this.checked) {
document.write("<?php echo php_func_c();?>");
}
else
{
document.write("<?php echo php_func_uc();?>");
}
}
</script>
<input type="checkbox" name="hit_val" value="hit" onchange="on_callPhp()">
<?php
function php_func_c()
{
echo "CHECKED";
}
function php_func_uc()
{
echo "UNCHECKED";
}
?>
</body>
</html>