How to check if a checkbox is ticked or not?..Generally,an 'if(isset($_POST())' would work,but instead of $_POST,what condition should be applied?
If you at using a Moodle form, then $data = $form->get_data(); if ($data->checkboxname) { ...
If not, then: $check = optional_param('checkboxname', false, PARAM_BOOL);
If not, then: $check = optional_param('checkboxname', false, PARAM_BOOL);
This works when i move to the next page after clicking the save button.But,i want to fetch the status of the checkbox as soon as the user checks or unchecks it.How can this be done?
You'll need some javascript to do that, you'll have to be a lot more specific about what you're trying to do, in order for anyone to help any more than that.
What i am looking for is ,when one checkbox is checked,i want other checkboxes to be checked simultaneously.Depending on the status of the checkbox,i want remaining checkboxes to be checked and unchecked.
As Davo mentioned above either use a javascript function or jquery to achieve this.
An example (not sure if it's any good); http://www.plus2net.com/javascript_tutorial/checkbox-checkall.php
Anne.