title: How to auto complete a variable
body: <p>Once I haven`t typed in all of the characters of one of the variables it shows this  </p>
  
  <blockquote>
    <p>nl,net,com</p>
  </blockquote>
  
  <p>But if I typed in the letter "n" after the DOT, I want it to show the variables that begin with a "n":</p>
  
  <blockquote>
    <p>nl,net</p>
  </blockquote>
  
  <p>How to do that?</p>
  
  <pre><code>$a = array("nl", "net", "com");
  
  $q = $_GET["q"];
  
  $domain = explode(".", $q);
  
  if (in_array($domain[1], $a)) {
      echo $q;
  } else {
      echo implode(',',$a);
  }
  </code></pre>