0

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**
?>

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by gmilby
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.