Simple python + html + from --> to python script

flit superflit at gmail.com
Tue Oct 24 17:37:50 EDT 2006


Sorry but for a totally newbie the lib doccumentation doesnt help..
The target audience for the docs are for "grown ups" programmers..
I think I will do some tutorial, in baby steps...

J. Clifford Dyer wrote:
> A good starting place would be the documentation on python.org.
>
> In this case, the python library reference would have been helpful:
>
> http://docs.python.org/lib/lib.html
>
> Cheers,
> Cliff
>
>
> flit wrote:
> > Man....
> > Very thanks...
> > I really try to find some source of good and simple and nothing..
> > Many thanks you are a great help!
> >
> > Steve Holden wrote:
> >> flit wrote:
> >>> Hello All,
> >>>
> >>> I am trying to get information from a form and send it to a python
> >>> script without success..
> >>> Here is my objective:
> >>>
> >>> User enters data in form --> form send variables to python script -->
> >>> script runs and output result.
> >>>
> >>> the form code
> >>>
> >>> <form method="post" action="/cgi-bin/script.py" name="coord">Entre com
> >>> os dados <input name="data1"><br>
> >>>
> >>> Entre com os dados <input name="data2"><br>
> >>> Vai magraum <button name="submete"></button></form>
> >>>
> >>> In my script.py
> >>>
> >>> What I should have to print
> >>> something like
> >>>
> >>> Hello the data1 + data 2 = ....
> >>>
> >>> ?
> >>>
> >>> Maybe I am stumbling in something very simple, but I cannot find some
> >>> working example, and I am totally confused...
> >>> Thanks in advance
> >>>
> >> Untested, without error checking. Caveat emptor:
> >>
> >> import cgi
> >> import cgitb; cgitb.enable() # optional error handling
> >>
> >> form = cgi.FieldStorage()
> >>
> >> d1 = form["data1"].value
> >> d2 = form["data2"].value
> >>
> >> print """\
> >> Content-type: text/plain
> >>
> >> Hello: the data were: %s and %s""" % (d1, d2)
> >>
> >> regards
> >>   Steve
> >> --
> >> Steve Holden       +44 150 684 7255  +1 800 494 3119
> >> Holden Web LLC/Ltd          http://www.holdenweb.com
> >> Skype: holdenweb       http://holdenweb.blogspot.com
> >> Recent Ramblings     http://del.icio.us/steve.holden
> >




More information about the Python-list mailing list