473,414 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

redirecting to a content page

I am a new user writing some scripts to store data entered via a
browser into a database. I have several content pages, and one
"processing" page. A content page often has a form like this:

<form method=POST action=processing.py>
<input type=text name=username>
....

And the processing page goes like this:

form = cgi.FieldStorage()
## do some work, put data into the db

The thing is, processing.py doesn't have any content that I want to
display to the user. I would ideally like processing.py to seamlessly
send the user back to the content page that it came from, perhaps with
some parameter tweaks.

Instead, I am having to write intermediate steps like this into
processing.py:

Return to the <a href=contentPage.py?submit=true>page</a> you came
from.

Please let me know if there's a way to do this, or if my general
approach (having such a processing page) is off.

Thanks,

Shreyas

- I did try searching for this in the archive but am not even entirely
sure what it is called...

Feb 21 '06 #1
3 1118
Shreyas wrote:
I am a new user writing some scripts to store data entered via a
browser into a database. I have several content pages, and one
"processing" page. A content page often has a form like this:

<form method=POST action=processing.py>
<input type=text name=username>
...

And the processing page goes like this:

form = cgi.FieldStorage()
## do some work, put data into the db

The thing is, processing.py doesn't have any content that I want to
display to the user.
And this is a GoodThing(tm). A successful post should always be followed
by a redirect.
I would ideally like processing.py to seamlessly
send the user back to the content page that it came from, perhaps with
some parameter tweaks.
import cgi

print "Location: %s\n\n" % url_of_the_page_you_want_to_redirect_to

(snip)
Please let me know if there's a way to do this, or if my general
approach (having such a processing page) is off.
Nope, having a separate script doing the form processing, then
redirecting is the right thing to do.

- I did try searching for this in the archive but am not even entirely
sure what it is called...


It's a redirection. If you are to work with CGI (or any other web
programming solution FWIW), you'd better know the HTTP protocol.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Feb 22 '06 #2
bruno at modulix wrote:
Shreyas wrote: [...]
The thing is, processing.py doesn't have any content that I want to
display to the user.

And this is a GoodThing(tm). A successful post should always be followed
by a redirect.

Really? Why's that?
[...]


regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Feb 22 '06 #3
Thanks much, Location: took care of what I needed. I'll look to the
http protocols for the future.

Shreyas

Feb 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David E. Smith | last post by:
I want to redirect input from one page to another, but it's POST content. If it were GET, I could just do something like: header("Location: /new/form.php?a=1&b=2") I can't rewrite the...
1
by: Gooseman | last post by:
Hi, I have a page where form data is passed to a php page (just script) to process the input. This page calls a function to output a file: function sendFileViaHeader($path, $name) { $fp =...
2
by: Nicolae Fieraru | last post by:
Hi All, I do some web design on an XP system and I intend to make a navigation system based on a browser interface. I created a home page on my local IIS and I see the page in IE. What I would...
11
by: Peter | last post by:
I have a modest website that uses a lot of Javascript. If anybody views the site and does not have Javascript enabled I want to politely redirect them to another page, so I put this bit of code...
2
by: Paul M | last post by:
hi there, i have an <asp:button> control on my webpage that when clicked, i want to redirect the HTTP request to an EXE file, but instead of actually directing the browser and address bar to...
9
by: Denise | last post by:
I have posted a similar message in 2 other forums but got no response. I have spent more hours than I can count researching this. Can anyone provide some insight...? Our ASP.Net application...
17
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
7
by: vjayis | last post by:
Hi I have created a loginpage in which the user enters their username and password., the page gets loaded and validates the input and then it is redirectesd to the seeeion page using html...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.