how to remember input data in the forms even after refresh page?

后端 未结 10 1506
日久生厌
日久生厌 2020-11-27 17:11

what to do in order to make the form remember the previous input or the current input of the user even after he/she refreshed the page ?

should I do ,



        
10条回答
  •  伪装坚强ぢ
    2020-11-27 17:44

    If you mean, filling out form fields and clicking refresh, then there is no direct way, as the data isn't submitted. That sort of behavior is up to the browser.

    The only thing you could do is post the data via AJAX back to your server as the fields change. Your PHP script receiving the data would set some session variables. When the form loads, you would set their default values to the appropriate session values.

    Rarely though is there a need for this kind of behavior. There will be many requests sent back and forth to your server.

提交回复
热议问题