We have the variables $p, q, r$.
Create a proposition $φ(p, q, r)→x$, using all three variables, that gives the result $x$.
$x$ should be equal to $p$ if $q = 1$, and equal to $r$ if $q = 0$.
I have created $(p∧q)$ and $(r∧¬q)$.
Is this answer correct? $$φ(p, q, r) ≡ (p→(p∧q)⊻r→(r∧¬q))$$
Not exactly since $\varphi(1,1,0)$ evaluates to $0$ instead of evaluating to $1$ as you desired. You can use the following method to find the expression you are looking for:
The resulting expression is $(p \land q \land r) \lor (p \land q \land \lnot r) \lor (p \land \lnot q \land r) \lor (\lnot p \land \lnot q \land r)$. You can use identities to simplify this in any way you want.