Let $R$ be a ring which is not a PID. The set $S$ of all ideals of $R$ which are not principal has a maximal element with respect to the inclusion (Zorn's Lemma), I already proved this! Now, I need to show that if $P$ is a maximal element of $S$, then $P$ is prime.
I tried by contradiction: suppose $a,b \not\in P$, but $ab \in P$. So $P+(a)$ and $P+(b)$ are not in $S$, and therefore they are principal ideals, say $P+(a) = (x)$ and $P+(b) = (y)$. Now, I just need to show that $P$ is principal. Any hint will be helpful.
Thus, I will conclude that for any ring, if all prime ideals are principal, then any ideal is principal.