Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Ted Byers
October 9, 2009, 4:37 pm
rate this thread
I have searched through my books, the FAQs I could find, the CGI
documentation, and have not found the answer, probably just an
oversight in the documentation I have examined.
For the most part, I have found it extremely easy to use the CGI
My frustration is that, while it is trivially easy to get form
parameters in my CGI scripts, I have not found how to either forward
or redirect the user to the HTML form he had just used to submit the
data my script had just processed. The script is just to move the
data into a DB, send an error page if there is a problem, and
otherwise return the user to the form ready to enter more data. The
form itself is static, and so exists as a simple HTML file in htdocs
(I'm using Apache's httpd).
I found something about just printing "Location: some_uri", but unless
the sources I read are mistaken, that needs a full path, and, as the
code will be moved from my development machine to a final home, I can
only know the relative path.
I know I could have the contents of the HTML file in the cgi file too,
but that carries its own problems WRT maintenance, and having the
script read the file and then print it carries performance issues.
What is the best option here?
Re: Simple question about CGI response after form data has been processed.
Ted Byers wrote:
The page that invoked your script is the referer. However, you can't
trust any information in a request, so you need to consider
the case where the caller lies to you. If you are just sending back
a redirect to that page, then you probably don't care.
If you generate a document with just a redirect header, then it suggests
to the browser that it go fetch that page, which it will do if it
Both are described in
- » FAQ 7.7 Why do Perl operators have different precedence than C operators?
- — Previous thread in » PERL Discussions