Hi i want send html select option disabled attribute with POST and enabled select option attribute with onclick in input form. For example i have:
<script>
function checked(){
var sel = document.getElementById("table A");
if(sel.options[sel.selectedIndex].text=='AAAA'){
document.getElementById('table B').disabled = false;
}
}
</script>
<?php
print("<form method=\"POST\">");
<print("<tr><th>Table A</th><td>
<select id='table A' name='table1'>
<option value=' '>Select</option>
<option name='AAAA' value='A' onclick=\"checked()\">AAAA</option>
<option name='BBBB' value='B'>BBBB</option>
</select></td></tr>");
print("<tr><th>Table B</th><td>
<select id='table B' name='table2' disabled>
<option value=' '>Select</option>
<option name='BBB' value='B'>BBBB</option>
<option name='CCC' value='C'>CCCC</option>
</select></td></tr>");
print("<tr><td><input type=\"submit\" id=\"save\" name=\"save\" value=\"Save\" ></td></tr>");
if(isset($_POST['save'])){
if(document.getElementById("table B").disabled){
return ' ';
}else{
$type_modify=$_POST['table B'];
}
?>
Now if i I do not disable select form table B i want send with post ' '. If i click select option name='AAAA' i want enable select with id='table B'. My code doesn't work. why?