every $I\!\trianglelefteq\!R$ is free $\Longleftrightarrow$ $R$ is a PID In a discussion on MO, I found someone claiming the following:
Proposition: For a commutative unital ring $R$, the following are equivalent:
(i) every submodule of a free $R$-module is free;
(ii) every ideal $I\!\trianglelefteq\!R$ is free as a $R$-module;
(iii) $R$ is a PID.
Proof: (i)$\Rightarrow$(ii) is obvious.
(iii)$\Rightarrow$(i) is theorem 8.6.1 in Grillet's Abstract Algebra.
But how can I prove (ii)$\Rightarrow$(iii)? I have to prove that $xy=0$ implies $x=0$ or $y=0$; and also that every $I\!\trianglelefteq\!R$ is of the form $I=(a)$. We know every $I\!\trianglelefteq\!R$ has a basis $B=\{b_i;i\!\in\!I\}$ and therefore $I\cong R^{(B)}$.
 A: Re-written, for clarity
Lemma 1: A non-zero free $R$-module is either isomorphic to $R$ or contains a sub-module isomorphic to $R\oplus R$.
Proof: Obvious
Lemma 2: If $I\!\trianglelefteq\!R$, then $I$ cannot contain a sub-module isomorphic to $R\oplus R$.
Proof: If $I$ contains a sub-module isomorphic to $R\oplus R$, then there are $x_1,x_2\in I$ such that $\forall r_1,r_2\in R: r_1x_1 + r_2x_2 = 0$ if and only if $r_1=r_2=0.$  But we can see that $x_2(x_1) + (-x_2)x_1 = 0$, so such $x_1,x_2$ cannot exist.
Lemma 3: Given $r\in R$, if $I=(r)$ is isomorphic to $R$, then $r$ is not a zero-divisor of $R$.
Proof: Obvious.
Lemma 4: If $I\!\trianglelefteq\!R$ is a free $R$-module, then $I$ is principal.
Proof: By the lemmas 1 and 2 above, $I$ must be $(0)$ or isomorphic to $R$ as an $R$-module.  But that means $I$ is principal.
Theorem: If every ideal of $R$ is a free $R$-module, then $R$ is a PID.
Proof: By Lemma 4, every ideal must be principal.  By Lemma 3, $R$ cannot have zero divisors. So $R$ is a PID.
