retaining form inputs after refresh...

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
alexander19
Posts: 180
Joined: Fri Apr 02, 2010 1:05 pm

retaining form inputs after refresh...

Post by alexander19 »

I've added a shoutbox inside my pvp script,the pvp script refreshes every 5-6 seconds.
The problem is that everytime the script refreshes and a player is typing something in the shoutbox form...his text input values wont be saved after the refresh,which is pretty annoying.
Been googling for some help on this,but ended up with cold fusion hints...which I cant really use.
Anyone got some ideeas on how to save the input values when the page is refreshing?
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: retaining form inputs after refresh...

Post by Chris »

Ouch. There are new methods to refreshing a page than the sounds of how you're doing it. The best method is called my little friend Ajax.

Ajax is an extension onto JavaScript which allows information to be sent to a server in the background so it can make reloads seem like they aren't happening :D

I'll write you a little tutorial. Bare with me.

The link will be here:
http://indie-resource.com/forums/viewto ... =26&t=2253
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: retaining form inputs after refresh...

Post by Jackolantern »

Ahhh, yes, it sounds like you have created a "polling" method in PHP and possibly a bit of Javascript. "Polling" means you keep re-checking the server to see if any updates are there, on a timer. Polling works horribly for PHP, for the exact reason you are seeing now. It is jarring to the user (it can even scare some less experienced users who think they have a virus), and it empties fields without some pretty annoying form retention techniques.

Definitely check out AJAX for something like this, and Chris is a very skilled person to learn it from :)
The indelible lord of tl;dr
Post Reply

Return to “Advanced Help and Support”