Forum Moderators: coopster

Message Too Old, No Replies

How to revisit a previously submitted form without resending info

         

stidj

4:26 am on Nov 19, 2003 (gmt 0)

10+ Year Member



Hi guys,

I have a form and I thought I had a caching issue but I believe the problem is a completely different one than originally thought.

Everytime I revisit the page (wishing to do a new submit) it always likes to resubmit any information I have submitted previously.

How can I make it so the browser stops sending the previous information and start fresh without it sending the post data to my form?

I have a form in a single file style.

So it looks like.

if ( form has been submitted without error)
{

do something

}
else
{
display the form and indicate any errors or omitted fields
}

Any help would be appreciated

jatar_k

4:24 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Most of the time I use processing/error checking scripts that are in seperate files from the actual form.

I can't say as I totally understand the behaviour you are describing but maybe try taking the processing out out of the form and move it into a seperate script.

Also if it submits everytime you hit the page your if($submit) test probably isn't working.

If you mean it just fills the form again it may just be your browser filling the form in for you.

DrDoc

6:53 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For example, consider the sticky mail pages here at WebmasterWorld...

[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]

So, let the form be submitted to one script... and let this script send a new header to a different file...

stidj

7:20 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



jatar_k

My form is refilling in values because it fills them in based on the previous post data variables which implies to me it is an issue with my script and the browser.

I believe my if submit is working properly and it seems like the browser remembers the previous post data submitted.

I could move the processing into a separate file which would elminate the problem I speak about but then I would not be able to keep filling in the correct values when some other fields are omitted.

DrDoc

thanks for the tips, I am checking out those links now.

jatar_k

7:27 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



but then I would not be able to keep filling in the correct values when some other fields are omitted

I just re include the form to do that. Another trick I have used when forms start misbehaving is to change the form name to trick my browser into not completing it.

Sometimes you need to just shut down the browser, clear cookies, clear cache and anything else you can think of, just to get an idea of how exactly it's misbehaving.

stidj

7:36 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



Thanks for the additional info jatar_k.

I think I have identified how it is misbehaving. This is probably due to the nature of my script though.

I however, am not quite clear why it does this only that is partly due to the style of my script.

If I make one submission and then in the same browser window go to the same url of the form, it gives me the previous result still. Meaning it seems to automatically remember and post the same data.

I believe my if ( $Submit ) is working properly because if I open a up a new window and don't submit at all, the script behaves accordingly.

Would it help if I pasted the entire code? I am hesitant because it is quite long but maybe that would make things clearer.

stidj

7:59 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



Here goes, here is what I am really talking about. The simple code found in the url below exhibits the exact same problem I am having.

support.powweb.com/tutorials/phpautoresponder.php

If you test the code by entering your name and click submit the script will ask for omitted fields to be filled in.

Then revisit the same page by going to the url again in your browser and you'll see you see the same results as before as if you resubmitted the same information. Instead I would like to see this behaviour stop and have the form display as if there was nothing submitted.

Hopefully this can bring us closer to finding a solution here.

[edited by: jatar_k at 8:32 pm (utc) on Nov. 19, 2003]
[edit reason] delinked [/edit]

jatar_k

8:32 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You've got to love scripts that are built for register_globals on, well maybe not.

It doesn't do it for me at all. I think it is your browser doing it and actually has nothing to do with the script. Maybe use an auto generated random form name so your browser can't auto fill because it can't identify it as the same form.

stidj

5:35 am on Nov 20, 2003 (gmt 0)

10+ Year Member



jatar_k

I notice that on IE6 I have the problem still but based on what you said I decided to try Opera and Opera does not produce this problem.

Even though this may be a browser issue is there a work around for this? The problem is that most people use IE6 so if somehow any of you can help find a way to fix this that would be great.

I've seen other forums and tutorials where people have complained of the problem I have noticed but no one can really find a solution to it as far as I can see.

If there is no solution can anyone show me a similar or least complex way to get the same results in the code above?

Thanks again everyone

jatar_k

5:51 am on Nov 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



open IE

tools > internet options > content > auto complete

uncheck forms

OK ... OK

then see if it still does it

stidj

6:52 am on Nov 20, 2003 (gmt 0)

10+ Year Member



I did and it still does it :(.

I have tested with Opera and Netscape but it only occurs with IE.

jatar_k

4:24 pm on Nov 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hm, I am surprised. I know it is in the settings for sure. I thought that was the one.

I use mozilla so I am not 100% on the settings of Exploder ;)

Have you tried changing the name of the form and seeing if that will stop it with auto complete off? I honestly don't know.

stidj

6:37 pm on Nov 22, 2003 (gmt 0)

10+ Year Member



I will try changing the name but I'm not sure if that will help. The bottom line for me is that it doesn't matter what settings these are in IE. 99.9% of other IE users will experience this and it is unacceptable.

I hope I can find a work around though, maybe changing the form name will help. I'll keep you guys posted.

stidj

7:11 pm on Nov 22, 2003 (gmt 0)

10+ Year Member



Ok, even having a random form name has not solved the problem. Does anyone else have any ideas?

Assuming this problem has no solution how could I rewrite my form to achieve the same results but not have the problems described above?