CGI: Run Script then load page

Lang bob at tharin.com
Tue Aug 7 01:40:56 EDT 2001


Tom Bryan <tbryan at python.net> wrote in message news:<9kj96l$vub$1 at slb2.atl.mindspring.net>...
>
> 

The posted script, of course, works perfectly.  But looking back to my
original posting, I realize I didn't really articulate my problem very
clearly.

I store values using cgi.Storage().  To have the values stay valid
from page to page, I am using this or a variation:


form = cgi.FieldStorage()

for key in form.keys():
    if not key == 'send':
        print "<INPUT TYPE=hidden name= " + key + " value= " +
form[key].value + ">",


So I would click my way to the day/month/year that I wanted to change
and click that day. This pulls up the data from the day, which, when I
finish making changes, it submits the changes to a script which
actually does the updating to the database.

In my original updating script, it updates the values in the database,
sets the form values as shown above, then prints out a button.  When
this button is clicked, it loads the default month script with the
month/year values set to those of the date I was just changing.  With
the HTML bit quoted below I click the submit button after making
changes, the database gets updated, and the default month script loads
all with just one click.  That is what I want, but the values are lost
and it defaults to the current date.  This can be a pain if I am
making several changes in December and it's now August.

Sorry for the long wordy post.  I've little experience programming and
less with Python, but I'm trying.

In short, does anyone know how to submit data to a script, have the
script run, and then load another page with the values still intact
with no user interaction (other than the first click)?  Thanks again.

---

-Lang

<knghtbrd> it's too bad most ancient unices are y2k compliant
<|Rain|> too bad?
<|Rain|> why, because people won't upgrade until 2038?


> ------ redirect.py ------
> #!/usr/bin/env python
> """A fairly simple CGI script that sends users elsewhere""" 
> 
> print "Content-Type: text/html"  # Just in case the redirect doesn't work.
> print "Location: http://www.python.org/\n\n"  # redirect
> # Just in case the redirect doesn't work.
> print """<html>
> <head>
>     <meta http-equiv="refresh" content="0;url=http://www.python.org/">
>     <title>Redirect</title>
> </head>
> <body>
>     Return to <a href="http://www.python.org/">Python web site</a>
> </body>
> </html>
> """
> ------
> 
> sending-users-elsewhere-for-2-years-ly yours
> ---Tom



More information about the Python-list mailing list