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"/>
</form>

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

$mobile=$_POST["mobile"];
**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.html:

<form name="input" action="form.py" method="get">
stuff:
<input type="text" name="stuff" />
<input type="submit" value="Submit" />
</form>
import cgitb
cgitb.enable()

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

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

tempfile.write(stuff)

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

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

thanks in advance for the help,
greg

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.