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
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']?>" />

 

:) :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.