国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - How to restore html form
扔個三星炸死你
扔個三星炸死你 2017-06-30 09:55:18
0
3
814

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

扔個三星炸死你
扔個三星炸死你

reply all(3)
淡淡煙草味

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

滿天的星座

The first one

Server

$_SESSION['username'] = $_POST['username'];

Template

<input name="username" value ="<?=$_SESSION['username']?>"/>

Second type

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/...

習(xí)慣沉默

Aren’t your inputs stored in the background data? Page loading request data.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template