Forum Academy Marketplace Showcase Pricing Features

Inputting into a database via a state


Hi Guys,

I am building a site where a feature is a user can add their social accounts to their profile. I have the social media platforms (Insta, TikTok & Twitter) as option sets.

For design I have made it so when creating a new account you simply click on the relevant logo, this changes the state so the relevant image has a green hew around it.

My question is, how do I now make it so it inputs the correct platform into the database via this state? I could get it to work if I didn’t have the option sets, but I want that for future proofing.

Thank you

PS: Sorry about mobile pictures, I’m currently out and had 10 minutes to kill so decided to try and sort this issue.

optionsertodb
hi @mike1 ,

I’m not sure about your data structure, but you can definitely save the created account’s platform to the database by using a custom state on the group containing your option set options; when a platform logo is selected, it is saved to the group and you can use that value to create/modify a record in the DB:

I am not sure how your database is structured, but my quick example creates a record that connects a user with a platform and adds the handle as well:

hope this helps!

OMG I have actually done it!!! Thank you so much! Woop

1 Like