Hello,
I will definitely help you out, but since I am travelling and does not have my workstation, I can not write testable code.
What you are doing is correct, so I will hint you for now
1. Access form id with $data->form_id
.
2. Use this snippet as a guide to access data https://iptlabz.com/snippets/4
If you want to appreciate my efforts, then please rate our products. It helps us establish stronger reputation across the marketplace.