#!/usr/bin/env python
import cgi

# This is for debugging
import cgitb
cgitb.enable()

# Pretty much just what header() does
print "Content-type: text/html; charset=utf8\n\n";

# Get query data ($_GET)
form = cgi.FieldStorage()


print """<!DOCTYPE html>
<html>
<body>
"""

if 'name' in form:
    print """<p>Hello, {name}!</p>\n""".format(name=form.getfirst('name'))
else:
    print """<form>
    <p> name: <input name="name"> </p>
    <p> <input type="submit" value="by your powers combined I am captain planet"> </p>
    </form>\n"""

print """</body>
</html>
"""