in reply to Re: the variable is not getting assigned
in thread the variable is not getting assigned

Note that in addition to the scoping problem if($code1 = 0) should probably be if($code1 == 0).

Curiously enough this node (in an interesting thread) about mistyping = for == in if clauses was cited a few hours before.