Page 1 of 1

Re-submit a form after reload page

Posted: Fri Mar 13, 2009 5:08 am
by marcopais
Hi there.

I have a form in main.php to insert data on a MySQL page. After submit, form action is process.php which inserts data. In the end of this file, it redirects (header()) to main.php again.

I did this to avoid re-submiting data after reload browser, but it isn't working. If I reload browser, data is inserted again.

I could control this with some cookies, but shouldn't it work like this?

Thanks in advance,

Regards,

MP

Re: Re-submit a form after reload page

Posted: Fri Mar 13, 2009 5:20 am
by susrisha
you should probably look at the header function manual.

1. There should be no output on the browser before you redirect.
2. Please check the syntax in case you might have missed something..
I had trouble even with a space character

Re: Re-submit a form after reload page

Posted: Fri Mar 13, 2009 5:20 am
by marcopais
Solved.

I was not using a submit button. Instead, I was using a normal button width a onclick event. With a submit button, the method I was using works.

Thanks anyway.