mercredi 8 février 2017

How can I email an html random output using ?

Right now I'm trying to have a random html output be emailed to me whenever the website page user clicks on the button. They receive a code displayed below the button when clicked. I need to have that random code whenever generated be e-mailed to my address. Here is my present code:

    <body>
    <h1>RandomCode</h1>

    <button onclick="document.getElementById('demo').innerHTML = makeid(1,1000)">Click Me</button>

    <p id="demo"></p>

    <script>
    function makeid()
    {
    var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";


for( var i=0; i < 5; i++ )
    text += possible.charAt(Math.floor(Math.random() * possible.length));

return text;
     }
     </script>
     </body>

As you can see the random code is outputted into the p tag. I need to have it so that they see the code, but the server automatically e-mails the code without them having to do it. They should be able to generate many codes sending me multiple e-mails. Can anyone help?




Aucun commentaire:

Enregistrer un commentaire