title: string.search() throwing a javascript error 'object doesn't support prperty or method search'
body: <p>I have searched all the other related questions but none the wiser.</p>
  
  <p>I am using javascript to capture form data when reloading the form so I can read the data in $_GET in php.</p>
  
  <p>It works fine unless there is an '&amp;' in a string.  The code with my comments:</p>
  
  <pre><code>oSupps = form.elements["supps[]"]; 
  //a multi-choice select element
  var supps = getSelectedOptions(oSupps);
  //returns a comma-separated list of selected items; this includes the correct string with
  the ampersand
  var params='supps='+supps;
  //sets up the string to be returned to the page in the next line of code
  self.location='instructor_register_2.inc?' + params;
  </code></pre>
  
  <p>The url shows the correct string with ampersand but the $_GET splits the string into 2 rows and loses the ampersand.</p>
  
  <p>An example:</p>
  
  <pre><code>string is "Abercrombie &amp; Fitch"
  $_GET is:
  supps   "Abercrombie"
  Fitch   ""
  </code></pre>
  
  <p>I tried to check for the ampersand in the string and escape it in the javascript with:</p>
  
  <pre><code>needle=/&amp;/
  pos=supps.search(needle)
  if(pos!=-1)
  {
      newsupps=supps.replace(" &amp; "," /&amp; ");
      supps=newsupps;
  }
  </code></pre>
  
  <p>but it will not get past the supps.search saying that 'the object doesn't support the property or method search'.</p>
  
  <p>I'm using the inbuilt browser in PhpED version 8.1.</p>
  
  <p>I cannot find any reference to search (and probably replace) not being supported in any specific browsers and they are included in all basic javascript tutorials that I can find.</p>
  
  <p>Any ideas please</p>