change eligibility batch from ssn to policy number, minor fix to filename with extra...
[openemr.git] / library / ajax / prescription_drugname_lookup.php
blob5160e5a9b8eb63334e426765220f4887092c5b7d
1 <?php
2 /**
3 * This file use is used specifically to look up drug names when
4 * writing a prescription. See the file:
5 * templates/prescriptions/general_edit.html
6 * for additional information
8 * @package OpenEMR
9 * @link http://www.open-emr.org
10 * @author Jason Morrill <jason@italktech.net>
11 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
12 * @author Brady Miller <brady.g.miller@gmail.com>
13 * @copyright Copyright (c) 2008 Jason Morrill <jason@italktech.net>
14 * @copyright Copyright (c) 2017 Sherwin Gaddis <sherwingaddis@gmail.com>
15 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
16 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
19 require_once("../../interface/globals.php");
21 if (isset($_GET['term'])) {
22 $return_arr = array();
23 $term = filter_input(INPUT_GET, "term");
25 $sql = "SELECT `drug_id`, `name` FROM `drugs` WHERE `name` LIKE ? ORDER BY `name`";
26 $val = array($term.'%');
27 $res = sqlStatement($sql, $val);
28 while ($row = sqlFetchArray($res)) {
29 $return_arr[] = $row['name'] . " - ". $row['drug_id'];
32 /* Toss back results as json encoded array. */
33 echo json_encode($return_arr);