inIn order to be prepolatedpopulated, the value of your hidden field needs to be the value of the variable- You might be confusing it with the SET statement of a variable:
assuming this code is above your hidden field:
set @contactid = Lookup("Test Extension", "Contact ID", "Contact ID", @contactid) , this is how you would enter the value into the hidden field:
<input id="contactIdField" name="contactIdField" type="hidden" value="%%=v(@contactId)=%%"> As a general note, always be cautious with prefilling forms from emails, as emails can be forwarded and thus personalized links can get into wrong hands, encrypted or not. This would surface PII. Just go through your due diligence before going to production.