You're already pretty much there. You name the variable in
the text file (e.g. "var1"). That var should be available to you
upon successful load of the file. Just put that variable name in
the first part of your IF statement. The second half looks fine.
(You could add something to make sure the user has typed something
into the input box.)