Jump to content


Photo

Back button with feilds


  • Please log in to reply
4 replies to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 11 March 2006 - 12:19 AM

i have a script that has a html form at the end. the loaction of the post is $PHP_SELF, so it loads the same page and goes down the route of if the submit button was pushed ect.

as its a login form, forms can be accidenlty missed out so the user has to push back button and fill it, but when they go back, it resets the feilds, so the user has to retype everything, how can it be avoided?
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 11 March 2006 - 12:57 AM

If they hit the back button, there isn't anything you can do. However, if, in your code you determine that something is incorrect, you can direct them back to the form and fill in the fields for them with the values that were posted. In other words, rather than them going "back", they would continue "forward" with you determining what happens.

#3 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 11 March 2006 - 01:02 AM

i see what you mean, but ive seen it be done before, in most website login forms it does it.
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 11 March 2006 - 01:11 AM

Part of it, I think, depends on your browser, but you can't rely on your users having a specific browser.

Another alternative would be to use javascript to set a cookie, then each time a field is changed, have the js set a value in the cookie. Then just have it retrieve the values from the cookie. However, if your collecting credit card data and other sensitive stuff, that would probably be a bad idea as well...which brings me back to what I originally suggested.

#5 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 11 March 2006 - 01:59 AM

well if you are submitting the form to itself then you can use the value="" in each element if it is type text or password. Textarea, selects, checkbox, etc are different. So for text simply value="<? echo $_POST['fieldname']; ?>". You can look for my information on form elements to find out exactly how to give it a predefined value and use the <? echo $_POST['fieldname']; ?> to do so.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users