form alter user login drupal 6
I recommend you to write the function as follow:

function ahml_form_alter(&amp;$form, $form_state, $form_id) {
  //for register page
  if ($form_id == 'user_register') {
    $form['my_field'] = array(
      '#type' =&gt; 'markup',
      '#value' =&gt; l('Login page', 'user/login'),
    );
  }
  //for login page
  if ($form_id == 'user_login') {
    $form['my_field'] = array(
      '#type' =&gt; 'markup',
      '#value' =&gt; l('Register link', 'user/register'),
    );
  }
}


For additional details, check Drupal 6 Form API Reference