Problem: Let $(X,\mathcal T)$ be a normal space, $A\subset X$ closed. (1) Let $C$ be a convex compact subset in $\mathbf R^m$. Prove that any continuous map $f:A\to C$ can be extended to a continuous map $f:X\to C$. (2) Let $f:A\to\mathbf R$ and $g_1,g_2:X\to\mathbf R$ be continuous functions. Suppose $$g_1(x)\le f(x)\le g_2(x),\forall x\in A\qquad \underline{\text{and}}\qquad g_1(x)\le g_2(x),\forall x\in X. $$ Prove: $f$ can be extended to a continuous function $\widetilde{f}:X\to \mathbf R$ such that $$g_1(x)\le \widetilde{f}(x)\le g_2(x),\forall x\in X.$$
My attempt: For (1) I tried to say that the projection of $C$ to any axis $\mathbf R$ is a closed interval; hence we can use the Tietze extension theorem, but we then get $f:X\to \prod[a_i,b_i]$, where $\pi_i(C)=[a_i,b_i]$. I don't know how to let the image be in $C$.
For (2) I tried to let $h(x)=\dfrac{f(x)-g_1(x)}{g_2(x)-g_1(x)}$, but I don't know how to deal with the case that $g_1(x)=g_2(x)$ for some $x$.