How to pass id of an item page to another database

Hello. I have a dynamic page with multiple items(category page) that have their own ids(Homes_ID) connected to a database called “Homes”. When users clicks 1 item, it will go to another dynamic page(item page) that has a user input form.

What I need help with is how do I code where when user submits the form, it will get all the data from the user input form along with the id of that item to another database called “Bookings”. I have linked them with reference fields but I need it to be automatically filled. Please help.

1 Like

I have the same issue, can anyone help!

Using Sessions Storage, how do we get the ID of the current item and store it in the session storage ?

Yes i think you are on the right way.

https://www.wix.com/corvid/reference/wix-storage.html

Yes, so I wanted to know regarding getting the id of the Item as part of the Item Page. Eg - I have a dynamic page of Teachers. When I click View Profile, it opens in the Item Page. How do I retrieve that id of the Current Item ? Do I need to use Wix Data Query or something simply like - let teacherid = teacher._id

//Here teacher is the

If you are on a dynamic page, so it should work like this…

let currentItem = $w('#YourDataset').getCurrentItem()

console.log(currentItem)
console.log(currentItem.title)
console.log(currentItem._id)
console.log(currentItem._owner)

…because on dynamic page there is just one item.

Yes, thank you so much!
I used getCurrentItem()._id as I wanted the specific ID.
I’ll store this in the sessions Storage to pass on the next page.

Thanks a lot!