The following conditions are equivalent for a ring $R$:
- every submodule of a projective right $R$-module is projective;
- every quotient of an injective right $R$-module is injective.
The proof is an interesting exercise, that can be done without homological algebra. Of course, both conditions are equivalent to the vanishing of $\operatorname{Ext}_R^n$ for $n\ge2$.
Now we can apply this to a PID $R$. A module $M$ over $R$ is called divisible if, for every $x\in M$ and every $r\in R$, $r\ne0$, there exists $y\in M$ such that $ry=x$.
Lemma. A quotient of a divisible module is divisible.
The proof is very easy.
Theorem. If $R$ is a PID, then an $R$-module $M$ is injective if and only if it is divisible.
Proof. Suppose $M$ is injective and let $r\in R$, $r\ne0$, and $x\in M$. The map $\alpha\colon R\to R$, $a\mapsto ra$ is a monomorphism, so there exists $\gamma\colon R\to M$ such that $\gamma\alpha=\beta$, where $\beta(a)=ax$. In particular, $x=\beta(1)=\gamma\alpha(1)=\gamma(r)=r\gamma(1)$. (Note: here we haven't used PID, just the fact that $R$ is a domain.)
Suppose $M$ is divisible. Then we can easily apply Baer's criterion to show that for every (nonzero) ideal $I$ and every homomorphism $\alpha\colon I\to M$, there exists $\beta\colon R\to M$ that extends $\alpha$, using the fact that $I=rR$ for some $r\in R$: set $x=\alpha(r)$ and take $y\in M$ such that $ry=x$. Then $\beta\colon a\mapsto ay$ is the required extension. QED