I have been trying to figure out how to enable a checkbox. I know how to do it in Javascript, but I’m wanting to do it in php.
I know it is possible, I just can’t seem to get it right.
[code=php]
<?php
//<!– <SCRIPT LANGUAGE=”JavaScript”> –>
//<!–
function codename() {
// if(document.formname.checkboxname.checked)
if ($checkboxname = checked)
{
// document.formname.textname.disabled = false;
$textname = false;
}
else
{
//document.formname.textname.disabled=true;
$textname = true;
}
}
//–>
// <!– </SCRIPT> –>
?>
and the HTML is:
[code=php]
<body>
<form action=”” method=”” name=”formname”>
<input type=”text” disabled size=”10″ name=”textname”>
<input type=”checkbox” onclick=”codename()” name=”checkboxname” value=”ON”>
<input type=”submit” value=”Add”>
<input type=”reset” value=”Clear”>
</form>
</body>
I know the php code there does not work. But I know that there is a way to make a function to enable the checkbox. I’m just not seeing it.
I’ve looked all over for a simple PHP script that I could use. Web search was useless.