Suppose $\mathbb{P}$ is a forcing. Let $\dot{\mathbb{Q}}$, $\dot{<_\mathbb{Q}}$, and $\dot{1}_\mathbb{Q}$ be a name such that $1_\mathbb{P} \Vdash_\mathbb{P} ``\langle \dot{\mathbb{Q}}, \dot{<}_{\mathbb{Q}}, \dot{1}_\mathbb{Q}\rangle$ is a forcing poset".
The question is: let $\dot{q}$ be some $\mathbb{P}$-name such that $p \Vdash_\mathbb{P} \dot{q} \in \dot{\mathbb{Q}}$. How do you show that there exists another name $\dot{r}$ such that $1_\mathbb{P} \Vdash \dot{r} \in \dot{\mathbb{Q}}$ and $p \Vdash \dot{r} = \dot{q}$?
Thanks.
The following is what is often known as the mixing lemma:
The idea is that $\sigma$ is a kind of superposition of the $\tau_p$; I like to think of this as analogous to taking linear combinations. Both Jech and Kunen give proofs of this (Lemma 14.18 in Jech and Lemma VIII.8.1 in Kunen), although they both bury it in the middle of other things and, in my opinion, don't give enough attention to this result.
As far as your problem is concerned, it is a typical application of the mixing lemma. Take your $p$ and extend it to a maximal antichain $A$. Let $\tau_p=\dot{q}$ and $\tau_{p'}=\dot{1}$ for all other $p'\in A$. The lemma then gives you a name $\dot{r}$. We get $p\Vdash \dot{r}=\dot{q}$ by construction and $1\Vdash \dot{r}\in\dot{\mathbb{Q}}$ since this is forced on a maximal antichain.