add filter for Has Nurse or Support Care

20/04/10

Permalink 12:30:20 pm, by sarneil, 300 words, 561 views   English (CA)
Categories: Activity log; Mins. worked: 180

add filter for Has Nurse or Support Care

ML asked to be able to filter search results based on whether either of two boolean values in a record were true. Took a couple of tries to figure out how checkboxes behave with regard to the POST array, but I finally figured it out with help from Greg and Martin 1) To report the status of a checkbox in the POST array and use that in PHP to set the state when the page reloads itself. If the checkbox is not checked, then no value is sent in the POST array, so the PHP that checks has to check not the value, but if isset($_POST[checkbox_element_id]). If that returns true, then write 'checked="checked"' into the page and if it returns false, then write nothing. If the PHP writes 'checked=""' or includes the checked attribute at all, then the checkbox is checked. In search.php: $is_nurse_or_support_care_checked = ''; if (isset($_POST['is_nurse_or_support_care_checked'])) { $is_nurse_or_support_care_checked = "yes"; } In includes/searchformbasic.inc: <label for="is_nurse_or_support_care_checked">Has Nurse or Support Care</label> <input name="is_nurse_or_support_care_checked" type="checkbox" id="is_nurse_or_support_care_checked" <?php if ($is_nurse_or_support_care_checked == 'yes') {echo ' checked="checked"'; } ?> value="checked" ></input> To modify the where clause to include only those records in which either of the two affected fields have the value 1 (as opposed to the only other possible value, which is 0) in search.php: if (!empty($is_nurse_or_support_care_checked)) { if (!empty($where)) {$where .= " " . $combine_fields_using_value . " ";} $where .= "("; $where .= "(exams.food_rest = '1') "; $where .= "OR (exams.nursing_care = '1') "; $where .= ")"; }

Pingbacks:

No Pingbacks for this post yet...

German Medical Exams

This project will create an xml-based database of medical exam reports from the 16th through 19th centuries in Germany. The database will allow researchers to query medical practices in that time and to infer changes in the administration of medical care and other social changes.

Reports

Categories

April 2014
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

XML Feeds