Ok, this is my confusing problem……In each of my client record info pages I have a dynamic list of email templates that are generated with a foreach peace of php code. When I am viewing a client record I can click an email template and the details of the current client are then loaded into a session.
Each email template in the list is dynamically wrapped in an tag and links to a email template loader.
The ID of the email template is part of the url as token=echo ID, so if I am viewing a client, I click an email template from the list and the email template loader loads the template into form fields using the ID in the url, plus also pulls in the client info from the session data.
When the send button is pressed, the completed form fields are then emailed.
The problem I have is in the view client page, next to each one of the dynamic template links needs to be the last time the client was emailed.
The problem I have is….each time a client is emailed with a template, the email is dynamically created from the merging of the template and the client info so I need to create something to connect the two that can be echo’d out at any time as a date, im not sure if its possible to create a unique id for the two to represent the two records as a whole, the thing is it would have to stay the same for that pair, so if I came back in 6 months and emailed them again, the record would be updated and not re created, records to connect the other templates with other clients etc would also be needed, so im a bit consused.
Im not sure if there is an easier way of doing this, whether it can be done easier with jquery, e.g when the template is clicked, the user id and template id are logged.
This is the view client page :

This is the form the info is loaded into :

It’s possible to create a unique id in PHP at runtime using uniqid