Processing HTML form

Marco Nawijn nawijn at gmail.com
Thu Jun 17 16:18:09 EDT 2010


On 17 jun, 21:11, Bradley Hintze <bradle... at aggiemail.usu.edu> wrote:
> Hi,
>
> I am a newbie to anything web related, I know a bit  of HTML though.
> I've been programing in python for a year or so so I know the language
> at an intermediate level. I am wondering if its possible to get info
> from an HTML form and pass it to my python code and return a page
> based on  the code executed. All of my web searches have been
> fruitless as I quickly get lost in the jargon and perhaps not sure
> what phrase i should search. Any help would be appreciated.
>
> Thank you,
> Bradley

Hi Bradley,

If I understand correctly, you want to do the following:
   1. Fill in a HTML form in a client (web browser)
   2. Send the form to a webserver
   3. Have the webserver extract the information from the form
   4. Send the information to a python program for processing
   5. Generate a new HTML page in python based on the information in
step 4
   6. Send the newly generated page back to the client

Possible solutions depend a little on the constraints and/or options
you have for the webserver. If you are free in your choices I would
suggest to start with cherrypy (www.cherrypy.org) for a webserver. It
is simple to start with, very powerfull and well documented. This
would cover steps 3 and 4. For step 5 I suggest you either use the
python builtin string template facility string.Template (for simple
things). If you want more power have a look at Genshi http://genshi.edgewall.org.

The two options I mention above help you to understand whats going on.
If you feel comfortable with this, you can take a look at python web
frameworks like Django or Turbogears (or many others).

Good luck and keep us posted with what your progress.

Regards,

Marco



More information about the Python-list mailing list