Update the Values in FORMS object and Save to Database

Dear all,

I am facing the following issue with Streamlit and would really appreciate some help.

I am creating a CRM system with Streamlit in order to SAVE, READ and UPDATE user data.
In order to achieve this, I created an FORMS object with multiple TEXT_INPUT objects.
In the Sidepanel, I have created a TEXT_INPUT field where the user can insert a Number and press a button. After pressing the button, the user is then shown a FORMS object with several TEXT_INPUT objects that are prefilled with the latest values from the database.

Now, I would like to update the existing values and press the SUBMIT_BUTTON to store the new values in the database. And here is where i am having problems with. As I update the TEXT INPUT objects in the FORMS Object, the new values are not being saved. The System just saves the old values into the Database when pressing the submit button.

Some pictures

Here i fill in the Account Number and Press “Get KYC” Button. I am then presented with a pre filled forms object with the latest values.

Now I have updated the Values in the Forms object and Would like to Save this to the Database

Here is my code:

def test_ui():
	st.sidebar.markdown("# KYC")
	# account number text input
	account_number = st.sidebar.text_input("Rekeningnummer:")
	get_kyc_button = st.sidebar.button("Get KYC")

	if get_kyc_button:

def ui_KYC_new(account_number):

	st.header('Know Your Customer')
	st.write('v 2021.01')
	with st.form(key="myform"):
# Get Existing Value form the database and present them in the Forms object
		Rekeninghouder_1 = st.text_input('Rekeninghouder 1:', get_kyc(account_number)['Rekeninghouder_1'][0], key="Rekeninghouder_1")	

		Rekeninghouder_2 = st.text_input('Rekeninghouder 2:', get_kyc(account_number)['Rekeninghouder_2'][0], key="Rekeninghouder_2")
		Vertegenwoordiger_Gevolmachtigde = st.text_input('Vertegenwoordiger / Gevolmachtigde:', get_kyc(account_number)['Vertegenwoordiger_Gevolmachtigde'][0], key="Vertegenwoordiger_Gevolmachtigde")
		st.form_submit_button(label='Submit', on_click=writekyc(account_number,Rekeninghouder_1,Rekeninghouder_2, Vertegenwoordiger_Gevolmachtigde))

# Function to get Existing KYC information from DB
def get_kyc(accountnumber):
	con = sqlite3.connect('example4.db')
	global engine

	df = pd.read_sql(f''' SELECT * FROM kyc1 WHERE account_number = '{accountnumber}' order by Datum desc limit 1;''', con = engine)

	return df
# Function to write new Values to Database
def writekyc(account_number,Rekeninghouder_1,Rekeninghouder_2, Vertegenwoordiger_Gevolmachtigde):
	con = sqlite3.connect('example4.db')
	today = date.today()
	# dd/mm/YY
	d1 = today.strftime("%d/%m/%Y")

	# create cursor object
	cur = con.cursor()

			INSERT INTO kyc1 (datum, account_number, Rekeninghouder_1, Rekeninghouder_2, Vertegenwoordiger_Gevolmachtigde) values ('{d1}', '{account_number}', '{Rekeninghouder_1}', '{Rekeninghouder_2}','{Vertegenwoordiger_Gevolmachtigde}')
	con.close() paste code here