Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:02:01+00:00 2026-05-23T22:02:01+00:00

I am writing a CGI script in python 2.5 and I have run into

  • 0

I am writing a CGI script in python 2.5 and I have run into an issue I cant solve.

My cgi script allows a user to into data into a html form and press refresh and the data gets successfully added. But it has turned out that if a user presses the refresh button on their browser the data that they inputted before gets added again. This is not the behaviour that I am looking for, and as such I would love to be able to redirect a user after a HTTP POST/GET request back to the main page.

This is of course naturally possible, by using the :

print "Location: www.website.here"

line in python. But I cannot do this as I need to be able to store messages between each refresh in order to be able to display information to the user.

These messages are essentially validation error messages, and if a user inputs wrong data and presses submit then my page should reload and print the error messages. I have this side of things working, but if I need to redirect using the above line, then I loose this.

So my question is are there any other possible ways to remove the option to refresh a html page using CGI and python, or am I looking at this all wrong and should I be trying to find a way to store my messages after a HTML redirect?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:02:02+00:00Added an answer on May 23, 2026 at 10:02 pm

    I assume you actually have two scenarios:

    1. The user entered the data correctly; reloading the page would cause the added data to be added again (which is wrong); the user may be redirected to the start page.
    2. The user did not enter the data correctly (there are error messages); reloading would cause the same message to be displayed again; redirect unacceptable.

    I suppose you can issue a redirect only if the data validates, and display error messages in the other case.

    If you have an option to migrate your CGI script to a modern web framework like Flask, Bottle, Django or Pyramid, I suggest you do so. This will give you session state and generally more convenient and modern environment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a CGI script that will process form data, and it should
I'm writing a simple Python CGI script that grabs a webpage and displays the
I am writing a cgi page in Python. Let's say a client sends request
I wrote a python script to process some data from CSV files. The script
I'm writing a Perl CGI script right now but it's becoming a resource hog
Using perl 5.8.8 on windows server I am writing a perl cgi script using
I'm writing a script that uploads a file to a cgi script that expects
I'm working on an audio encoder cgi script that utilises libmp3lame. I'm writing in
I have a need to upgrade a Perl CGI script where the users must
I've been writing python scripts that run locally. I would now like to offer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.