Prime ideal is a contraction of some prime ideal iff $p^{ec} =p$ I see a problem when I read Proposition 3.16 in Atiyah-Macdonald book. The statement is:

Let $\phi : A\to B$ be a ring homomorphism and let $P$ be a prime ideal of $A$. Then $P$ is the contraction of a prime ideal of $B$ iff $P^{ec}=P$. i.e. $\phi^{-1}\phi(P)=P$.

The part "if" is easy. But the converse, I got stuck. Let $S = \phi(A \backslash  p)$. They said that $P^{e}$ does not meet $S$, I do not think so. Because $0$ can be a element in $S$, then we can have $0 \in S\cap P^{e}$. At this time, $S^{-1}B$ is trivial.
If $P^{e}$ does not meet $S$, I wonder why $Q\cap S=\varnothing$ and $Q^{c}=P$
 A: If $\varphi: A\to B$ denotes the given homomorphism, then $A\setminus{\mathfrak p}=A\setminus {\mathfrak p}^{ec}=A\setminus\varphi^{-1}({\mathfrak p}^e)=\varphi^{-1}(B\setminus{\mathfrak p}^e)$, so $S := \varphi(A\setminus{\mathfrak p})$ intersects ${\mathfrak p}^e$ trivially. Does this make things clearer?
Addition: In case you are (now or later) interested in developing geometric understanding for these kinds of algebraic statements: When wlog assuming ${\mathfrak p}=0$, the present statement means that if $\text{Spec}(B)\to\text{Spec}(A)$ is dense, then that's already true for the restriction to some irreducible component of $\text{Spec}(B)$. 
A: Proposition 3.16 in Atiyah can also be stated as follows:

Let $A\to B$ be a morphism of commutative rings, let $\mathfrak a$ be a contracted ideal in $A$, and let $S$ be the set of those ideals in $B$ which contract to $\mathfrak a$. (In particular $S$ is nonempty.) Let us order $S$ by inclusion. Then we have
(a) $\mathfrak a^e$ is the least element of $S$, or, equivalently, $\mathfrak a^e$ is the intersection of all the elements of $S$,
(b) $S$ has one, or more, maximal elements,
(c) if $\mathfrak a$ is prime, then any maximal element of $S$ is also prime.

The proofs of these statements are straightforward and elementary. I'll prove (c), the proofs of (a) and (b) being similar and left to the reader.
To prove (c), let $\mathfrak q$ be a maximal element of $S$. Assume by contradiction that $\mathfrak q$ is not prime. Then there are ideals $\mathfrak{b,b}'$ in $B$ such that $\mathfrak q$ is a proper sub-ideal of $\mathfrak b$ and $\mathfrak b'$, and the product $\mathfrak{bb}'$ is contained in $\mathfrak q$. By maximality of $\mathfrak q$, the prime ideal $\mathfrak a$ is a proper sub-ideal of $\mathfrak b^c$ and $\mathfrak b'^c$. We also have 
$$
\mathfrak b^c\mathfrak b'^c\subset(\mathfrak{bb}')^c\subset\mathfrak q^c=\mathfrak a,
$$ 
in contradiction with the primality of $\mathfrak a$.
