How to create an autocomplete textbox in register page - Drupal 6
There's a full example for Drupal 6 here: [Textfield that uses autocomplete][1]. The code will probably be useful to people on this site as well so I'll post i here:

The following is based on a module with the name: 'cities'

In your form function:

$form['city'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; 'City',
  '#maxlength' =&gt; 128,
  '#autocomplete_path' =&gt; 'cities/autocomplete',
);


In your module file:

function cities_menu(){
  // path with autocomplete function for cities
  $items['cities/autocomplete'] = array(
    'title' =&gt; 'Autocomplete for cities',
    'page callback' =&gt; '_cities_autocomplete',
    'access arguments' =&gt; array('use autocomplete'),  //or whatever permission makes sense
    'type' =&gt; MENU_CALLBACK
  );
  return $items;
}


Also in your module file:

function _cities_autocomplete($string) {
  $matches = array();
  //search table `cities` for cities that begin with the letters the user enters in the form
  $result = db_query_range("SELECT city FROM {cities} WHERE LOWER(city) LIKE LOWER('%s%')", $string, 0, 10);
  // add matches to $matches
  while ($data = db_fetch_object($result)) {
    $matches[$data-&gt;city] = check_plain($data-&gt;city);
  }
 print drupal_to_js($matches);

}