coldkill Posted March 28, 2006 Share Posted March 28, 2006 How do you keep values in a form which someone has entered.IE with this forum if you reload your post a topic page it keeps the values you entered in the form. For some reason i thought it was a header() output but i forgot what and can't find it anywhere now :S.Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/6034-keeping-values-in-a-form/ Share on other sites More sharing options...
wildteen88 Posted March 28, 2006 Share Posted March 28, 2006 Do you post a message and then go back a page and are you using FF? I find that FF tends to save your last sent data temporarily and so is a browser based feature rather than a PHP one. I believe the extension SessionSaver does this too. Quote Link to comment https://forums.phpfreaks.com/topic/6034-keeping-values-in-a-form/#findComment-21725 Share on other sites More sharing options...
gavinandresen Posted March 30, 2006 Share Posted March 30, 2006 [!--quoteo(post=359406:date=Mar 28 2006, 02:22 PM:name=coldkill)--][div class=\'quotetop\']QUOTE(coldkill @ Mar 28 2006, 02:22 PM) [snapback]359406[/snapback][/div][div class=\'quotemain\'][!--quotec--]How do you keep values in a form which someone has entered.[/quote]Generally, when the form is first submitted you save the values somewhere (a database is a good place).And when the user goes back, you fetch the values from the database and then display the form with values in the right spots.Is that what you mean? I have some examples of how I do something like that at [a href=\"http://www.skypaint.com/gavin/code/\" target=\"_blank\"]http://www.skypaint.com/gavin/code/[/a] .... Quote Link to comment https://forums.phpfreaks.com/topic/6034-keeping-values-in-a-form/#findComment-22140 Share on other sites More sharing options...
Javizy Posted March 30, 2006 Share Posted March 30, 2006 I did this before with jsp by keeping an array of validated values (blank strings for invalid values) and printing them in the necessary input elements. You can easily extend this to highlight the invalid fields by changing the CSS class of the input element.[code]$values = array("name" => "Jiminy", "address" => "", "Post Code" => "RM7 4RT");<input type="text" value="<?echo $values["name"]?>" />[/code]I'm not sure for what purpose you need them, but I just wanted to make it more convenient for users who made a mistake. Quote Link to comment https://forums.phpfreaks.com/topic/6034-keeping-values-in-a-form/#findComment-22146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.