If $R$ is a PID and $p \in R$ is prime, then $R/p^2$ has exactly three ideals (since $p^2$ has exactly three divisors in $R$, up to units).
These are all: Let $A$ be a commutative ring which has exactly three ideals. The maximal ideal is generated by every non-zero non-unit. In particular, $A$ is a principal ideal ring. Hungerford has proven (T. Hungerford, On the structure of principal ideal rings, Pacific J. Math. 25, 1968, 543-547) that every principal ideal ring is a finite direct product of quotients of principal ideal domains. But since $A$ is local, we can only have one factor. So $A \cong R/I$ for some PID $ R$ and some ideal $I \subseteq R$. If $I = \langle a \rangle$, the condition that $A$ has exactly three ideals means that $a$ has exactly three divisors in $R$, up to units. If $a=0$, the PID $R$ has exactly three elements up to units, which is clearly wrong (take $0,1,p,p^2$ for any prime $p$). So $a \neq 0$, say $a \sim p_1^{k_1} \cdots p_s^{k_s}$. The number of its divisors up to units is $(k_1+1) \cdots (k_s+1)$, and this can only be $=3$ when $s=1$ and $k_1=2$.