added formDataToDb function