Let $g,h \in \mathbb{k}[x]$ and $f=gh$ then there's a ring homomorphism $\mathbb{k}[x]/(f) \rightarrow \mathbb{k}[x]/(g)\times\mathbb{k}[x]/(h)$ I've been trying to prove this for a while now but I'm a little rusty and I'm pretty sure this isn't right.

Let $\mathbb{k}$ be a field and  $g,h \in \mathbb{k}[x]$ so that $f = gh$. Prove that there's a morphism $\phi : \mathbb{k}[x]/(f) \rightarrow
 \mathbb{k}[x]/(g)\times\mathbb{k}[x]/(h)$

I proposed the canonical projection since $\pi(\bar p(x))= \pi (p_1(x) + \alpha(x)h(x)g(x))=(\bar p_1(x), \bar p_1(x))$ implies that $\pi(\bar 1)= \pi (1 + \alpha(x)h(x)g(x))=(\bar 1,\bar 1)$.  
Then $p_1(x) + \alpha(x)g(x)h(x) + p_2(x) + \beta(x)g(x)h(x)\mapsto (\bar p_1 + \bar p_2, \bar p_1 + \bar p_2)= (\bar p_1, \bar p_1) + (\bar p_2, \bar p_2)$
And finally
$(p_1 + \alpha gh) (p_2 + \beta gh) = p_1 p_2 + gh\psi \mapsto (\bar p_1 \bar p_2, \bar p_1 \bar p_2) = (\bar p_1, \bar p_1).(\bar p_2, \bar p_2)$
So for example if we let $\mathbb{k}=\mathbb{R}$, the kernel of the homomorphism would be $\bar 0$.
Any pointers would be greatly appreciated.

The canonical morphism is defined by $\phi(\overline p)=(\overline p,\overline p)$. (Sorry for using the same notation for the residue classes modulo $(f)$, $(g)$, and $(h)$.) To show that $\phi$ is well defined suppose that $\overline p=\overline q$ in $k[x]/(f)$, so $f\mid p-q$. Then $g\mid p-q$ and $h\mid p-q$ and you are done.
The kernel of $\phi$ is nothing but $(g)\cap(h)$ which equals the ideal generated by the least common multiple of $g$ and $h$ (and this isn't necessarily $f$). 
