I am reading Dummit and Foote Ch 8, Section 8.3 Unique Factorization Domains (UFDs)

I am studying Proposition 11 on page 284 (see attachment) which reads:

"In a Principal Ideal Domain, a non-zero element is a prime if and only if it is irreducible"

I follow the proof (see attachment) down to the statement:

But p is irreducible so by definition either r or m is a unit (OK so far!)

[ so we have if r is a unit then there exists an element u of the PID such that ru = ur = 1 and if m is a unit then there exist a PID element v such that mv = vm = 1]

But then D&F state the folowing:

"This means that either (p) = (m) or (m) = (1) respectively."

Can anyone show me formally how this follows from the statement that either r or m is a unit?

WOuld appreciate the help!

Peter