Let $\left\{e_1, \ldots, e_n\right\}$ be a finite orthonormal system in an inner product space $(E,\langle\cdot, \cdot\rangle)$ and let us abbreviate $F:=\operatorname{span}\left\{e_1, \ldots, e_n\right\}$. The mapping $$ P: E \longrightarrow E, \quad P f=\sum_{j=1}^n\left\langle f, e_j\right\rangle e_j $$ is called the orthogonal projection onto the subspace $F$. I would like to prove that $P$ does only depend on the subspace $F$ and not on the chosen orthonormal basis of $F$ used in the construction of $P$.
My attempt
Let $f, g \in E$ such that $g \in F$ and $f-g \perp F$, I have to prove that $g=P f$. Since $f-g \perp F$ and $f-Pf\perp F$, we have that $$\langle f-g, e_i\rangle=\langle f-Pf, e_i\rangle=0\quad \forall i$$ then $$\langle f-g, e_i\rangle-\langle f-Pf, e_i\rangle=0$$ and so $$\langle f-g -(f-Pf), e_i\rangle=0\quad \forall i$$ from which $$\langle Pf-g, e_i\rangle=0\quad \forall i$$ And now? How could I proceed? I think that $Pf-g\perp F$ is not true, so we should have $Pf=g$.
I think your attempt works: at the last point you have $Pf-g \perp F$ but by their definitions, $Pf-g \in F$ also, so $Pf-g \in F\cap F^{\perp}$ hence $\|Pf-g\|^2 = \langle Pf-g, Pf-g\rangle =0$ (where holds because I may consider $Pf-g \in F$ in the left-hand entry and $Pf-g\in F^{\perp}$ in the right-hand entry of the inner product, so the inner product is zero, hence $Pf-g=0$, that is, $Pf=g$.
This argument actually gives you a way of proving the result in a slightly cleaner way: What you need is
Claim: If $F\leq E$ is a subspace of an inner product space, then $E = F\oplus F^{\perp}$.
The claim proves the result about the projection map to $F$ because $E=F\oplus F^{\perp}$ means precisely that every vector $v\in E$ can be written in the form $v = f+g$ where $f \in F$, $g \in F^{\perp}$ in exactly one way, so that $f$ and $g$ are uniquely determined by $v$, hence we may define $P\colon E\to F$ by setting $P(v)=f$. The uniqueness of the expression $f+g$ then ensures that $P$ is linear.
Proof of Claim: The inner product (if we work over the real numbers), gives a map $\theta\colon V\to F^*$, where $\theta(v)(f) = \langle v,f\rangle$, for all $v \in V, f\in F$. Since the inner product is bilinear, it follows that $\theta$ is linear, and $\theta(v) = 0$ implies $0=\theta(v)(f) = 0$ for all $f \in F$, that is, $\text{ker}(\theta)= F^\perp$.
Now consider $\theta_F\colon F\to F^*$, the restriction of $\theta$ to $F$. If $f \in \ker(\theta_F)$ then $\theta(f)(f)=0$, so that $\|f\|^2 = \langle f, f\rangle=0$, and hence $f=0$. Thus $\ker(\theta_F) = F\cap F^{\perp}=0$, and hence by rank-nullity applied to $\theta_F$ we see that $\dim(\theta_F(F)) = \dim(F) = \dim(F^*)$ and hence $\theta_F(F)=F^*$, which in particular implies $\theta(E) = F^*$, that is, $\theta\colon E \to F^*$ is surjective, so that $\dim(E) = \dim(\ker(\theta)) +\dim(\theta(E))$, that is, $\dim(F^{\perp}) + \dim(F)=\dim(E)$.
Since we already know $F\cap F^{\perp} = \{0\}$ it follows that $E=F\oplus F^{\perp}$ as required.