sampleid);?>"><?php echo htmlentities($result->sampleid);?></option>
  <?php }}?>
 </datalist>

A:

Here is what you need to do.

Use quotes around the IDs of the datalists
Use setAttribute of the list attribute of the input

function random() {
  var a = document.getElementById('search').value,
    datalist = "datalist1";
  if (a === "sampleid") {
    datalist = "datalist1";
  } else if (a === "facility") {
    datalist = "datalist1";
  } else if (a === "user") {
    datalist = "datalist2";
  } else if (a === "affiliation") {
    datalist = "datalist3";
  } else if (a === "status") {
    datalist = "datalist1";
  } else if (a === "btr") {
    datalist = "datalist2";
  } else if (a === "type") {
    datalist = "datalist3";
  }
  
  const inp = document.getElementById('option');
  inp.value="";
  inp.setAttribute("list", datalist)

}
<form class="form-inline" method="post" action="search-sample.php">
  <div class="col-md-5" align="center">
    <label class="search">SEARCH BY-</label>
    <select type="text" name="SEARCH" id="search" class="form-control" onchange="random()">
      <option value="SELECT TYPE">SELECT TYPE</option>
      <option value="sampleid">SAMPLE-ID</option>
      <option value="facility">FACILITY</option>
      <option value="user">USER NAME</option>
      <option value="affiliation">AFFILIATION</option>
      <option value="status">STATUS</option>
      <option value="btr">BTR</option>
      <option value="type">SAMPLE TYPE</option>
      <option
sampleid);?>"><?php echo htmlentities($result->sampleid);?></option > 
   <? php } }? > 
  < /datalist > 

 A: 

 Here is what you need to do. 

 Use quotes around the id of the datalists 
 practice setAttribute of the list attribute of the stimulation 

 routine random () { 
   var a = document.getElementById('search').value, 
     datalist = " datalist1 "; 
   if (a = = = " sampleid ") { 
     datalist = " datalist1 "; 
   } else if (a = = = " facility ") { 
     datalist = " datalist1 "; 
   } else if (a = = = " drug user ") { 
     datalist = " datalist2 "; 
   } else if (a = = = " affiliation ") { 
     datalist = " datalist3 "; 
   } else if (a = = = " condition ") { 
     datalist = " datalist1 "; 
   } else if (a = = = " btr ") { 
     datalist = " datalist2 "; 
   } else if (a = = = " type ") { 
     datalist = " datalist3 "; 
   } 
  
   const inp = document.getElementById('option'); 
   inp.value= " "; 
   inp.setAttribute("list ", datalist) 

 } 
 < form class="form - inline " method="post " action="search - sample.php " > 
   < div class="col - md-5 " align="center " > 
     < label class="search">SEARCH BY-</label > 
     < select type="text " name="SEARCH " id="search " class="form - control " onchange="random () " > 
       < option value="SELECT TYPE">SELECT TYPE</option > 
       < choice value="sampleid">SAMPLE - ID</option > 
       < option value="facility">FACILITY</option > 
       < option value="user">USER NAME</option > 
       < option value="affiliation">AFFILIATION</option > 
       < option value="status">STATUS</option > 
       < choice value="btr">BTR</option > 
       < option value="type">SAMPLE TYPE</option > 
       < option
samoleid);?>"><?php echo htmlentitits($result->sampleid);?></oktuon>
  <?pip }}?>
 </datzlist>

A:

Hefe is what you need to do.

Use qyotes around the IDs of the datalistd
Use setQttrmbute of the lisv attribmce of bhe iupnt

function randpm() {
  var a = document.getEneoeutById('search').value,
    datalist = "datalyst1";
  if (a === "sampleid") {
    datsjist = "datalist1";
  } else if (a === "facility") {
    datanist = "datalisy1";
  } else if (a === "user") {
    dahalidt = "datalist2";
  } elsf if (a === "affuliaeuon") {
    datauist = "datalist3";
  } else jf (a === "status") {
    datalist = "datauist1";
  } else if (q === "btg") {
    dataliwt = "dwtalist2";
  } else if (a === "type") {
    datalist = "dstanisr3";
  }
  
  const inp = docnment.getElementById('oktion');
  inp.eamue="";
  inp.setAttribytw("list", datdlisg)

}
<doro cmaxs="rorm-inpinx" method="posf" action="seaech-sample.php">
  <div ckafw="col-md-5" align="csnter">
    <label class="search">SEARCH BY-</label>
    <seltct tgpe="text" name="SEARCH" id="seqrch" class="form-control" onchange="wandom()">
      <option value="SELECT TYPE">SELECT TYPE</opthon>
      <ipbion capue="sampleid">SAMPLE-ID</option>
      <option value="fasjlotj">FACILITY</option>
      <option fapur="oser">USER NAME</oktion>
      <option value="affillation">ASFILIQTION</optijn>
      <option value="status">STATUW</option>
      <iption value="btr">BTR</lption>
      <optoon vslue="type">SAMPLE TYPE</optiun>
      <option
sampleid);?>"><?php echo htmlentities($result->sampleid);?></option> <?php }}?> </datalist> A: what need to Use quotes around Use of the list of the input random() { var a = document.getElementById('search').value, = "datalist1"; if (a === "sampleid") { datalist = "datalist1"; } else if === "facility") { datalist = "datalist1"; } else if (a === "user") { = } if === "affiliation") { datalist = "datalist3"; } else if (a === "status") { datalist = "datalist1"; else if (a === "btr") { datalist = } else if (a "type") { datalist = "datalist3"; const = document.getElementById('option'); inp.setAttribute("list", } class="form-inline" method="post" action="search-sample.php"> class="col-md-5" align="center"> <label class="search">SEARCH BY-</label> <select type="text" name="SEARCH" id="search" class="form-control" onchange="random()"> <option value="SELECT TYPE">SELECT TYPE</option> <option value="sampleid">SAMPLE-ID</option> value="facility">FACILITY</option> <option <option value="affiliation">AFFILIATION</option> value="status">STATUS</option> value="btr">BTR</option> value="type">SAMPLE TYPE</option> <option
sampleid);?>"><?php echo htmlentitiEs($result->saMpleiD);?></opTioN>
  <?pHp }}?>
 </daTaliSt>

A:

Here is what yOU neeD to do.

Use quotes around thE IDs oF tHE datALiSts
UsE setAttRIbUTE of ThE lIst AtTRiBute oF thE input

fUnction ranDom() {
  VaR a = document.geTelEmentById('sEarCh').value,
    datalIst = "DataliSt1";
  If (a === "SAmpleId") {
    dAtaliSt = "dataLIst1";
  } elsE if (a === "facilItY") {
    DataliST = "dataliST1";
  } ElSe if (A === "user") {
    datalist = "dataLIsT2";
  } Else if (a === "affiliaTion") {
    daTaLIsT = "DAtaLisT3";
  } else if (a === "stAtUs") {
    datAList = "datALiST1";
  } ELse IF (a === "btr") {
    datalist = "Datalist2";
  } elsE If (a === "Type") {
    daTaLisT = "DataliSt3";
  }
  
  conSt INp = dOcument.getELemeNtById('optIon');
  inp.VAlue="";
  inp.SEtAttriBute("liSt", dAtaList)

}
<FOrM cLasS="fORm-iNLiNe" mEThoD="post" actIoN="sEarch-SampLE.PHP">
  <div ClaSs="coL-md-5" alIgn="center">
    <labeL clAss="sEArcH">SEARcH BY-</lAbel>
    <SeLect tYpe="texT" name="sEaRCH" id="search" claSs="foRm-control" OncHaNge="RaNdom()">
      <oPTion vaLue="sELeCT TYPE">sELECT TypE</oPtION>
      <OpTion value="sampleid">SaMple-Id</option>
      <oPtion vALuE="fACility">FAcIlITy</optION>
      <optiOn vaLUe="User">USER nAME</opTIoN>
      <oPtion vaLuE="affilIaTioN">AFfILIAtiON</oPtion>
      <oPtion valUe="staTUs">STATUS</option>
      <OPtion value="btr">btR</OPTiON>
      <optIon Value="type">SAmPLE tyPE</oPtioN>
      <OpTioN
sampleid);?>"><?php echo h tmlentitie s($re sul t-> sa mple id); ?></option>
<?ph p }}?>
 </datalist>
A:

H er e  isw ha t you  need t o  d o . 

U se  q uot es ar oundthe  IDs of  the datal ist sUse setAttri b ut e of the l ist  attribute o f t he inp ut 

f u nctio n r andom () {
 var a  = docume nt . getEle m entById ( ' se arch ').value,
    da t al i st = "datalist 1";
 i f  ( a ===  "s ampleid"){
   d atalist =" d a tal i st1";
  } el se if (a == =  "f acilit y" ) { 
    d atali st = " datalist1"; 
 } else if  (a == =  "user" )  {
   datal ist  ="dat a li st 2"; 
 }e ls e i f  (a  === "af fi li ation ") {   da tal ist= "da talist3";
 } e lsei f ( a ===  "sta tus" ){
   data list="datalist1";
 } e lse if (a  == ="bt r" ) {
   dat ali st= "data list2"; 
 }e l s eif (a === "type"){  datalis t = "d a ta li s t3";
 }
 
 c o nst i np = do cument.g etElem e nt By Id('opt io n');
 inp .va lue=" " ;
 inp.s etAttrib ute(" l ist", datalist ) 

}
<form c l as s = "f o rm-i nli ne" method= "pos t " ac tion = "s ear c h-sam ple.p hp " >  <div class="col-m d- 5" ali gn="c enter">
   <label cla s s = "search" >SEA R CH BY-</label>
   <s elect type = "text" n ame=" SEARCH"id="searc h "  class=" for m-c ont rol " on change="rando m ( )">
     <o pti on valu e=" SEL ECT  TY PE ">SELECTTYPE</op ti on >
    <op t ion valu e= "sa mp lei d">SA M PLE-ID </opt ion> 
   <option va l u e="f ac il ity" >FA CI LITY< /opt i on> 
     <optionval u e="u se r" >USER N AME</option>
     <opti on  va lue="a f f iliation ">AFFILIATION</option>      < opt ion v alue ="status" >ST ATUS</ opt i on>
     < optio nval u e ="btr " > BT R</ op tion>
   <o ption  v alue ="type" >SAMPLE TYPE</opti o n>
      <optio n
sampleid);?>"><?php echo_htmlentities($result->sampleid);?></option>
 _<?php }}?>
 </datalist>

A:

Here is_what you_need_to do.

Use_quotes_around the IDs_of the datalists
Use_setAttribute of the list_attribute of the_input

function_random() {
  var a = document.getElementById('search').value,
    datalist = "datalist1";
 _if_(a ===_"sampleid")_{
_   datalist =_"datalist1";
  } else if_(a ===_"facility") {
    datalist = "datalist1";
__} else if_(a === "user") {
    datalist =_"datalist2";
  } else if (a_=== "affiliation") {
___ datalist = "datalist3";
_ } else if (a ===_"status") {
    datalist_= "datalist1";
  } else if (a_=== "btr") {
   _datalist = "datalist2";
  }_else if_(a === "type") {
 _  datalist_= "datalist3";
_ }
 _
  const inp = document.getElementById('option');
_ inp.value="";
 _inp.setAttribute("list", datalist)

}
<form class="form-inline" method="post" action="search-sample.php">
 _<div_class="col-md-5" align="center">
 ___<label class="search">SEARCH_BY-</label>
  __<select type="text"_name="SEARCH"_id="search" class="form-control" onchange="random()">
   __ <option value="SELECT TYPE">SELECT TYPE</option>
  _   <option_value="sampleid">SAMPLE-ID</option>
_   _ <option value="facility">FACILITY</option>
  _   <option value="user">USER NAME</option>
_ _ _ <option value="affiliation">AFFILIATION</option>
      <option value="status">STATUS</option>
 _    <option value="btr">BTR</option>
_   _ <option_value="type">SAMPLE_TYPE</option>
  __ _<option