Refresh button

This is a discussion on Refresh button within the PHP Language forums, part of the PHP Programming Forums category; I have what is probably a simple question. In a form I get the variables with $_POST and then enter ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-15-2007
coder
 
Posts: n/a
Default Refresh button

I have what is probably a simple question. In a form I get the variables
with $_POST and then enter an insert into a database. After doing this, I
set the variable to an empty string. The form displays this empty string.
So far, so good.

If the user now hits the refresh button on the browser, the value of the
variable stays at the old value, not the empty string, so it passes the test
for not empty and another entry is inserted into the database.

How can I prevent this from happening?


Reply With Quote
  #2 (permalink)  
Old 10-15-2007
ZeldorBlat
 
Posts: n/a
Default Re: Refresh button

On Oct 15, 11:14 am, "coder" <co...@coder.com> wrote:
> I have what is probably a simple question. In a form I get the variables
> with $_POST and then enter an insert into a database. After doing this, I
> set the variable to an empty string. The form displays this empty string.
> So far, so good.
>
> If the user now hits the refresh button on the browser, the value of the
> variable stays at the old value, not the empty string, so it passes the test
> for not empty and another entry is inserted into the database.
>
> How can I prevent this from happening?


This question has been asked and answered in this newsgroup so many
times (probably about once per week). It shouldn't be hard to find
the answer with a little bit of searching.

Reply With Quote
  #3 (permalink)  
Old 10-15-2007
coder
 
Posts: n/a
Default Re: Refresh button


"ZeldorBlat" <zeldorblat@gmail.com> wrote in message
news:1192461634.392862.14190@i13g2000prf.googlegro ups.com...
> On Oct 15, 11:14 am, "coder" <co...@coder.com> wrote:
>> I have what is probably a simple question. In a form I get the variables
>> with $_POST and then enter an insert into a database. After doing this,
>> I
>> set the variable to an empty string. The form displays this empty
>> string.
>> So far, so good.
>>
>> If the user now hits the refresh button on the browser, the value of the
>> variable stays at the old value, not the empty string, so it passes the
>> test
>> for not empty and another entry is inserted into the database.
>>
>> How can I prevent this from happening?

>
> This question has been asked and answered in this newsgroup so many
> times (probably about once per week). It shouldn't be hard to find
> the answer with a little bit of searching.


You are correct. I searched and it was as simple as adding a header line
back to the same page. That flushed the post values. Sorry.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:33 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0