<?php /*=== function: build_dept_radio: void -> void purpose: expects nothing, tries to build and output a dynamically-built logically-related set of radio buttons containing the current department names and numbers, and returns nothing. * if it cannot connect to the database, hum_conn_sess should cause it to complain and then exit, including destroying the current session and including a link to hopefully-conveniently start over requires: hum_conn_sess() last modified: 2024-04-17 ===*/ function build_dept_radio() { // try to query department names and numbers $conn = hum_conn_sess(); $dept_stmt = oci_parse($conn, "select dept_num, dept_name from dept order by dept_name"); oci_execute($dept_stmt, OCI_DEFAULT); // they chose radio buttons! while (oci_fetch($dept_stmt)) { $next_dept_num = oci_result($dept_stmt, "DEPT_NUM"); $next_dept_name = oci_result($dept_stmt, "DEPT_NAME"); ?> <input type="radio" name="dept" value="<?= $next_dept_num ?>" id="<?= $next_dept_num ?>" /> <label for="<?= $next_dept_num ?>"> <?= $next_dept_name ?> </label> <br /> <?php } oci_free_statement($dept_stmt); oci_close($conn); } ?>