* @author Brady Miller * @copyright Copyright (c) 2014-2016 Rod Roark * @copyright Copyright (c) 2018 Brady Miller * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ require_once("../globals.php"); use OpenEMR\Common\Csrf\CsrfUtils; //verify csrf if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) { CsrfUtils::csrfNotVerified(); } $listid = $_GET['listid']; $target = $_GET['target']; $current = $_GET['current']; $res = sqlStatement("SELECT option_id FROM list_options WHERE list_id = ? AND activity = 1 " . "ORDER BY seq, option_id", array($listid)); echo "var itemsel = document.forms[0][" . js_escape($target) . "];\n"; echo "var j = 0;\n"; echo "itemsel.options[j++] = new Option(" . js_escape("-- " . xl('Please Select') . " --") . ",'',false,false);\n"; while ($row = sqlFetchArray($res)) { $tmp = js_escape($row['option_id']); $def = $row['option_id'] == $current ? 'true' : 'false'; echo "itemsel.options[j++] = new Option($tmp,$tmp,$def,$def);\n"; }