Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: form clears Date: Mon, 6 Jun 2016 07:55:04 +0200 Lines: 19 Message-ID: References: <17ae5655-a03c-406a-96aa-329855db29d7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 742MvC7wvfoiTTU02g7nWQ5cX98wz6D/sxwmy1ur/fo1qXdlg2 Cancel-Lock: sha1:zwL+UGyQh/m1S/vvJYNPRvk/tgU= X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <17ae5655-a03c-406a-96aa-329855db29d7@googlegroups.com> Xref: csiph.com comp.lang.php:16759 On 06/06/2016 02:35 AM, mike7411@gmail.com wrote: > Anyone know why a form clears when I go back to it? > > All of the fields seem to clear on this form if there's an error and I hit the back button: > > http://www.coolfone.mobi/ads/ As the value in the input tag is not set to a value, it will be empty. When you display the error, you should have a button/link which takes you back to the form, you also store the values to a session. When you display the form you check in your session if there are any values set, if, then populate the value in each input from the session. Remove the values from the session as you have repopulated them. -- //Aho