'Is there a way to send one data package from multiple input fields as 1 package to Firebase?

I'm sending info from 3 input fields on a mobile app made in Unity (Coded in C#) to Firebase database, but as you can see it seems to send each input field's data individually then stacks it on top of one another.See attached Ideally I'd only want the last set of complete information.

using System.Collections;
using System.Collections.Generic;
using Proyecto26;
using UnityEngine;
using UnityEngine.UI;

public class PlayerScores : MonoBehaviour
{
    public InputField dateText;
    public InputField classText;
    public InputField informationText;

    User user = new User();

    public static string Information;
    public static string Class;
    public static string Date;

    // Start is called before the first frame update
    private void Start()
    {

    }

    public void OnSubmit()
    {
        Date = dateText.text;
        PostToDatabase();

        {
            Class = classText.text;
            PostToDatabase();
        }

        {
            Information = informationText.text;
            PostToDatabase();
        }
    }

    public void OnGetScore()
    {
        RetrieveFromDatabase();

    }

    private void PostToDatabase()
    {
        User user = new User();
        RestClient.Put("https://anti-bullying-demo.firebaseio.com/" + Date + Class + Information + ".json", user);
    }

    private void RetrieveFromDatabase()
    {
        RestClient.Get<User>("https://anti-bullying-demo.firebaseio.com/" + Date + Class + Information + ".json").Then(response =>
        {
            user = response;
        });
    }
}


Solution 1:[1]

In your OnSubmit() function call, you call PostToDatabase() three times - you only need call it once at the end.

public void OnSubmit()
{
    Date = dateText.text;

    {
        Class = classText.text;
    }

    {
        Information = informationText.text;
    }

    PostToDatabase();
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 samthecodingman