Suppose I have a form
<form>
<input name="username"/>
</form>
Now when the user enters the username, the second time the user comes to the page again, the username has been obtained from the server. How can the input on the page display the username that the user has entered
淡淡烟草味2017-06-30 09:57:18
Two solutions
Backend: Get the data from the backend and assign it to the input
Frontend: Save the input value to local cookie or localStorage
滿天的星座2017-06-30 09:57:18
Server
$_SESSION['username'] = $_POST['username'];
Template
<input name="username" value ="<?=$_SESSION['username']?>"/>
Refer to the comment function of this blog website. After the user enters the user name and email address for the first time comment, localstorage caches it. Next time, the cache is directly read and assigned to the value of the form
https://blog.codefun.cn/blog/...
習慣沉默2017-06-30 09:57:18
Aren’t your inputs stored in the background data? Page loading request data.