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

后端 未结 10 1489
日久生厌
日久生厌 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:58

    There are some main issues to check in order to get the data appear after refresh or any event handler:

    1) Be aware of the signature. it must contain the method="post" attribute as follows:

        

    else the using of the $_POST['messenger'] will not work.

    The default value of the method attribute in the form is get.

          equals to  
    

    2) Many programmers mix between the attributes id vs name. Be aware of using the correct attribute. The $_POST associative array is using the name to get data from it. That is why the next example will not work correctly:

        "
    

    To get it work right you must add the attribute name="data" as follows:

        "
    

    Good luck

提交回复
热议问题