How can I hand off variables from web form to python, process then post back to a response page?

PHP Form Code:
<form method="post" action="test.php">
Mobile <input type="text" name="mobile"/>
<input type="submit" value="Submit"/>

and test.php (that the form was posted to)

**pass to python to process, write to db, then post back**

Just so i can show effort/hopefully spark someone into giving me a breadcrumb or trowin' me a bone as it were - here's what i got so far:


<form name="input" action="" method="get">
<input type="text" name="stuff" />
<input type="submit" value="Submit" />
import cgitb

form = cgi.FieldStorage()
if not (form.has_key("stuff"):
    print "<H1>Error</H1>"
    print "Please put stuff in the field."
print "<p>name:", form["stuff"].value

tempfile = open ( 'stuff.txt', 'a' )


result is it tries to download the (permissions set to 775)

would really like to achieve this without cgi if it's possible...???

thanks in advance for the help,