Maybe the question isn't clear enough.
I have the table **users** that has username, email, password, and orderID.
Once a user is logged in, he can access a page where he can click a button that means that the user confirms the order and generates a random string that is displayed to the user.
This is done by Javascript:

```
function randomString() {
    var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
    var string_length = 8;
    var randomstring = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
}
randomstring=randomstring.fontsize("6");
randomstring=randomstring.bold();
document.getElementById("demo").innerHTML = "Your order id is: "+ randomstring;
}

```

The Simple HTML

```
<div class="row">
  <div class="span6"><button  onclick="randomString()">Rezervo</button></div>
  <div class="span6"><p id="demo"></p></div>
</div>

```

Everything works great, but how can the logged in user insert this generated code in his orderID column in the database when the button is clicked? 
Please help me.
Sorry for bad english. Not my first language.