St.form and st.text_input values not getting captured

Hi everyone,

Been trying to solve this for a few hours now and seems to be getting nowhere. Hope somebody can point to me what am I doing wrong.

Basically, I am making a query to a mysql database to get some info. After getting the results, I will parse those and assign them to values (eg. name, age, sex).

I create another form using st.form and have several text_inputs where the initial value will be name, age, sex. This shows correctly. I then want the user to be able to edit the text_input and click a submit button named “Update” which will capture the values and use them for the UPDATE statement to mysql. However, it does not capture the values in the form and just returns blank.

From what I understand, for example name_form = st.text_input(“Name”,value=name) even if name was initial value when form spawns, when edited it should be assigned to the name_form. Or if not edited or changed, it will still be initial value assigned to name_form. Is this correct?

Thanks!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.