When data in table fetched, I need to disable exam_type. Below code works for that. But after data in table loaded I input some values and they are stored with the exam_type name. But it is disabled after first load.
Question: How to disable exam_type when data fetched and then enable the field when marks are entered in the table.?
<select class="form-control" name="exam_type" id="exam_type" style="width: 100%;" <?php if ($student_details) {
echo "disabled";
} ?> >
<option value = "1" <?php if ($exam == 1) echo 'selected'; ?> >H</option>
<option value = "2" <?php if ($exam == 2) echo 'selected'; ?> >A</option>
<option value = "3" <?php if ($exam == 3) echo 'selected'; ?> >M</option>
<option value = "4" <?php if ($exam == 4) echo 'selected'; ?> >N</option>
</select>
<input type="hidden" name="action" value="save" class="form-control">
<?php
if ($action_type == 'save') {
echo '<input type="submit" name="save" value="Save Marks" class="btn btn-block btn-primary">';
} else {
echo '<input type="submit" name="save" value="Load Students" class="btn btn-block btn-primary" onclick="return validateForm(); ">';
}
?>