Pass data from search form to an object/database

We just created an app and it consists of:

-Login form

-search form

Results returned in table format. There is a link for detailed results view and also a link to download a PDF.

-2 Database objects (data and users).

I'm trying to find a workaround since we don't have an option to 'log' or 'track' who is searching for theory it would work like this:

1. Person logs into the app.

2. Person fills out the search fields (name and state required).

3. Person clicks Submit to search and a record is inserted into another database object that simply has:

-Username/Name of user that searched

-Search fields (i.e Name of agent searched for and state).

-Would be cool to also log these things when someone tries to download the PDF certificate in the search results (record created showing who tried to download a PDF file and which record it's associated with.)

Any thoughts on the best way to go about this? I'm not a super coder but can figure some things out (network engineer here...). I just got the "last login" code working but that's as far as I've gotten.

Any ideas on how to accomplish this would be great!