Jump to content

[SOLVED] Refill form values


tommyboy123x

Recommended Posts

How do other sites make it so that when you fill out a form and you mess something up (e.g. the password / verify password are not the same), the values are still in the input box?

 

I could throw out a bunch of sites that do this... even registering for this forum, web.com, and almost every other place.

 

 

 

For a while firefox would autosave it on my site so that when you click back it is waiting for you, but i put in this javascript / php text replacement thing that interferes with that because it generates an image every time the page is loaded so it is not all in the cache or something like that...

Link to comment
https://forums.phpfreaks.com/topic/67630-solved-refill-form-values/
Share on other sites

Once you clicked submit button the values entered in the form is stored in $_POST or $_GET as per your method of the form. So in order to retreive the previously entered value, try the following

 

Suppose the name of your textfield is "username"

 

For method=POST

  <input name="username" type="text" id="name" value="<?=$_POST['name']?>" />

For method=GET

  <input name="username" type="text" id="name" value="<?=$_GET['name']?>" />

 

:) :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.