Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

Refresh problem (when user submit data)

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

Refresh problem (when user submit data)

Postby WoozyDuck » Mon Jan 03, 2005 2:43 pm

Hi all

I have a shoutbox system on my web site HOME PAGE.
when user submit a shout that screen will be refresh and then
he can see the shout in shoutbox.

The problem is lots of users press [F5] to refresh the screen
to see the new shouts all the time!
when you do that exactly after submiting a form, browser will
ask you you are submiting the same data , are you sure you want
to contiue and sadly all of users answer YES to it!

in this case we will have tons of repeating shouts in shoutbox!
I know one sulotion for this is like directing user to another page
after submiting the form and redirect him to home page again so
data in form will be deleted!

but I dont wanna do that for some reason.
so is there any way to clean the data from FORM after submiting
the data by users?
User avatar
WoozyDuck
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby ruturajv » Mon Jan 03, 2005 9:36 pm

In such a case, POST the contents on page A and then transfer from page A to page B where the actual results are displayed.
and on this page B, a refresh won't create problems
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India

Postby Alexej Kubarev » Tue Jan 04, 2005 1:23 pm

In case you dont want to do like ruturajv said:

Make a post on the same page an then simply header-redirect to the same page..

Code: Select all
if($_POST){
 #saving to the database here
 /*......*/
 header("Location: ".$_SERVER['PHP_SELF']);
}
 #Here you may have whatever you want to..
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby WoozyDuck » Tue Jan 04, 2005 5:15 pm

Thanx ruturajv for the answer
But I want to use the same page

and thanx Alexei
Finally you got me the code
i am happy you didnt say ITS EASY , FIND IT YOURSELF, hahahaha
Thanx mate
I will try it

Ciao
User avatar
WoozyDuck
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed May 05, 2004 10:14 am

Postby Alexej Kubarev » Wed Jan 05, 2005 2:43 am

:D finally we are getting along m8 :D
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.