Use variable for show/hide field name

Use variable for show/hide field name

I need a way to use a variable to show or hide a field name (ultimate goal is to show fields based on the values in a different table)

Let's assume that there is a field called "Email"

What I need to happen is: 
  1. foobar = "Email";
  2. hide foobar;
Unfortunately this results in an error message: "Variable 'foobar' is not defined.
Is there any other way to show/hide a field where the field name is determined by a variable rather than the exact field name?