You can do that with PHP in a custom code action - you'll need to add the value to the $form->data[''] array to save it using a DB Save action. See this tutorial for an example of using the code to set and get.
Bob
PS Remember that in many countries you need to get user permission to use cookies.