How do I add classes to form elements in the theme layer? I want to do it in template.php. The form ID is page_node_form, and there are six form text fields. The default class is "form-text." 

I want to add "text1," "text2," etc after "form-text" to each input text class. How can I do it?

This is the HTML:

&lt;input gtbfieldid="10" id="edit-field-14sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"&gt; 
&lt;input gtbfieldid="10" id="edit-field-14sq-und-0-value" name="field_15sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"&gt; ....
This is an ideal situation for a preprocess function.

I don't have Drupal 7 working to test at the moment, but something like this in your template.php should do the trick.

function mytheme_preprocess_textfield(&amp;$vars) {
  static $counter = 0;
  $counter++;
  $vars['element']['#attributes']['class'][] = 'test' . $counter;
}