Let $\pi \colon E \to X$ be a fiber bundle with fiber $F$ and suppose that $\tilde H^i(F) = 0$ for $0 \leq i \leq k-1$.
Using the Leray-Serre spectral sequence, we get an exact sequence $$ 0 \to H^k(X) \to H^k(E) \to H^k(F) \to H^{k+1}(X) \to 0. $$ Therefore, a class in $H^k(E)$ is pulled back from a class in $H^k(X)$ if and only if it is zero when restricted to the fiber.
I want to show this using explicit representatives of these cohomology classes as homotopy classes of maps into Eilenberg-Maclane spaces.
That is, given a map $f \colon E \to K(\mathbb Z,k)$ such that the composition $F \to E \to K(\mathbb Z, k)$ is null-homotopic, I want to explicitly construct a map $g \colon X \to K(\mathbb Z, k)$ such that $f \simeq g \circ \pi$.
How could I go about this? I've read some obstruction theory, but haven't found anything applicable. If it helps, the specific case I'm interested in is when $F = T^n * T^n$ is the join of two tori and $k=3$.