HELP PLEASE

I have copied the code below from an older thread, however I need to use it. The only problem is, I have no idea how to personalize it for my website. Here is the code below: (Scroll down to continue reading my post)

import wixData from ‘wix-data’;

export function insertDog(owner, $w){
let dog = {
“id”: $w(" #dogid “).value,
“name”: $w(” #dogname “).value,
“weight”: $w(” #dogweight ").value,
“owner”: owner._id
};

console.log("dog to be saved" + JSON.stringify(dog)); 

wixData.insert("Dog", dog) 
.then( (results) => { 
	let dog = results; //see item below 
	console.log("dog in db: " + JSON.stringify(dog)); 
} ) 
.catch( (err) => { 
	let errorMsg = err; 
} ); 

}

export function submitbutton_click(event, $w) {
let person = {
“name”: $w(" #ownername “).value,
“ssn”: $w(” #ownerssn ").value
};

console.log("person to be saved" + JSON.stringify(person)); 

wixData.insert("Person", person) 
.then( (results) => { 
	let owner = results; //see item below 
	console.log("person in db: " + JSON.stringify(owner)); 
	insertDog(owner, $w);		 
} ) 
.catch( (err) => { 
	let errorMsg = err; 
} ); 

}

This code is used for submitting data from one form into two databases, so that data can have more uses throughout my site. As you can see, the data in the code above is of someone’s website, but I need the data to be of my website. How can I do this? What parts of the code do I need to change to make it for my website? Thanks! (I really need this answered soon because I am in the middle of a major update for my website)

You will need to change the database collection names: for example: wixData.insert(“Person”, person) Also, all of the screen UI component names (e.g. #componentName) need to be changed to the names used on your new site.

Good luck,

Yisrael

Hi Yisrael,
Thanks for your response! I have a question about the portion of code below:
“id”: $w(" #dogid “).value,
“name”: $w(” #dogname “).value,
“weight”: $w(” #dogweight ").value,
“owner”: owner._id

What should I do with “id”, “name”, “weight” and “owner”. Can I leave these alone or do I need to edit them?

Those are the database collection fields and should be named accordingly.