Save login input text

2

Personal I need to record 2 fields of the login screen of my program, I want to give facility to the friend that has logged in, he does not need to enter things like company code, and email. I tried to use the autocomplete but it did not have any functionality. Is there any language (HTML, CSS, JAVASCRIPT) that makes this easy or do I have to create a method?

I thought of saving in a cookie, where if it has it saved if it does not save?

I tried setting the autocomplete with jquery like this:

<script>
  jQuery('#codigo').attr('autocomplete','on');
  jQuery('#email').attr('autocomplete','on');
</script>
    
asked by anonymous 03.03.2016 / 18:24

2 answers

2

SAVING IN SESSION IS SAFER!

$_SESSION["LOGIN"] = "VALOR";

Remember: SESSION will get saved only in the current session, closing browser will delete the session.

Do not forget to connect to the session at the top of the script:

Code:

session_start();

If you prefer to save in cookie for a certain time it is also ideal!

    
03.03.2016 / 18:40
1

The solution I found was much simpler than I thought it was, I used localstorage technology, so I could save all the data needed for my login.

        <script>
        var codigo = localStorage.getItem("codigo"),
                email = localStorage.getItem("email"),
                senha = localStorage.getItem("palavra");

        $("#codigo").val(codigo);
        $("#email").val(email);
        $("#palavra").val(senha);

        $("#entrar").click(function () {
            localStorage.setItem("codigo", $("#codigo").val());
            localStorage.setItem("email", $("#email").val());
            localStorage.setItem("palavra", $("#palavra").val());
        });

    </script>
    
03.03.2016 / 18:39