Output text from a user input form

Hey Wix Forum users, I have a (hopefully) simple question.

Background: I’m building a website that needs to allow users to input their address, phone number, name, and email, and then redirect to another page where this very same text is displayed on a page. Sounds easy, right?

I used Wix Code to add a database. I created a form for user input. I tested this form, it works great. I set this database to all Admin Only, with the exception of who can read from the database, which is set to anyone. I then added a hidden page (the one that redirects on submission of the form).

I created a dataset (read only) attached to my database. Here’s the problem.

I need to output the text (the address, phone, etc.). I tried using a list, connecting it to my dataset. The list changed after I connected my dataset, and showed all the proper fields that should be displayed- except none of the text. And to add another catch, I only want the information that was inputted by a user to be displayed on the redirected page, not everyones information before them.

I’m not much for code, but I’m more than willing to use HTML elements and code if I need to.

Thank you so much for any and all help.

Hi wrightdesign86 and welcome to Wix Code community,
wix-storage allows you to save data to the user’s browser,
Session storage is removed after the user closes the web browser, local storage is kept for longer (until you clear cookies)
Try this code in the form page

import {session} from 'wix-storage'; 
session.setItem("key", "value");

And use this after redirection:

import {session} from 'wix-storage';
let value = session.getItem("key"); // "value"

Good luck!
Roi

Thank you so much for the help! That sounds like just what I need to do!

Just a few more questions for ya.

How does wix-storage work? I can’t find any information on it at all. I copy/pasted the code into my page code and it told me that “session” is undefined.

Any useful info on the value and key that a Noob should know? Thanks man I appreciate it

Hi,

Are you importing session from wix-storage as in Roi’s example?

For more info regarding the key and value javascript object please see here
The following code should work on any page:

import {session} from 'wix-storage'; 
session.setItem("key", "value");

$w.onReady(function () {
	console.log(session.getItem("key"));

});