Im lost on this problem:

Let B be a basis for a subspace W of an inner product space V, and let z exist in V. Prove that z exists in W^perp if and only if <z,v>=0 for all v in B.

All I have is that <z,x>=0 for all x in W.

cant seem to figure out how to prove either direction of the statement though.