This is how I selected the first form in my code.
br.select_form(nr=0)
#Form fields to populate
br.form['username'] = username
br.form['password'] = password
#Submit the login form
br.submit()
Modify it to suit your needs. The "nr=0" is probably what you're looking for.
But the problem is the DOCTYPE. I tested the following, and it strips it out.
html = br.response().get_data().replace('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd >', '')
response = mechanize.make_response(
html, [("Content-Type", "text/html")],
url, 200, "OK")
br.set_response(response)
I took this straight from the Mechanize FAQ.