Input Username to Database from Different Pages and Form

Hello , can anyone help me , here i am trying to make a page specifically to user input username after registration on different pages , after i try column in the database are filled not as it should have.

Thank you and sorry for my bad english.

When the user registers (signs up) to your website the password is saved in the Wix CRM and not in any of your own datasets.

For the user to be able to add their username into their row in the dataset, then you need to query the id of the user so that it knows who the user is and where to put it in the dataset itself.

Otherwise, it will just create two entries as shown in your picture which will each have a different id instead.

If you are wanting to collect the users first and last name and username and anything else, then simply just create your own signup and login lightboxes so that the user can enter all those user inputs when they first sign up to your site.

Have a look at this tutorial here if you are wanting to have a members dataset etc.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

If you look at the register api info, then you will see that you need to put all the details that you want to save to your members collection in the 'contact info section of your code.
https://www.wix.com/corvid/reference/wix-users.html#register

Thank you for your response.

Can you give me a code, to insert data by owner is login ?

https://www.wix.com/corvid/reference/wix-users.User.html
https://www.wix.com/corvid/reference/wix-users.html
https://www.wix.com/corvid/reference/wix-users-backend.html

https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq
https://www.wix.com/corvid/reference/wix-data.html#insert
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#save

Hello, I still have a problem about this, yesterday i tried to insert code into the page.

Code is :

$w.onReady( function () {

let user = wixUsers.currentUser;
let userId = user.id; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user.loggedIn; // true
user.getEmail()
.then( (email) => {
let userEmail = email;
} );
$w(“#done”).onClick( () => {
let toInsert = {
“username”: $w(“#username”).value,
};
wixData.insert(“User”, toInsert)
.then( () => {
wixLocation.to(“/Home”);
} )
. catch ( (err) => {
let errorMsg = err;
$w(“#error”).show();
});
});
});

But the result is still remains the same.

Can you help me easier ?, thank you so much.