CF7 select value get to function and reciept value from function

This may be a terrible way to go about population of a CF7 field… However, the way I have done so in the past is to use an identifier as the default value of the field you want to populate, for example {{cf7_year}}.

I would then use a mixture of PHP to query and get the values (if required), and format that result into a string that can in-turn be used in Javascript to replace within the document the term {{cf7_year}} with the string that you have created in PHP, or plain text, or however you’re working.

Something a bit like this:

var course_email = "<?php echo $email; ?>";

document.body.innerHTML = document.body.innerHTML.replace('{{course_email}}', course_email);