This question is just a rephrased version of my earlier question Wedge product is zero. Suppose we have two functions $f(x^i), C(x^i)$ and there is the equation
$$ \partial_s f \partial_t C=\partial_t f \partial_s C.$$
Is $f=f(C)$ the most general solution? If yes, why?
Let's consider the matrix
$$\left(\begin{array}{cccc} \partial_1 f & \partial_2 f &\cdots & \partial_n f\\ \partial_1 C & \partial_2 C &\cdots & \partial_n C\end{array}\right).$$ If the conditions given in the question are satisfied, the matrix must have, at most, rank one. This means that at any point $\nabla f\| \nabla C.$
Assuming $\nabla C\ne 0,$ the condition $\nabla f\| \nabla C$ implies that $f$ is constant on the level hypersurfaces of $C$ (at least, on its connected components). So, at least locally, $f$ and $C$ share its level hypersurfaces. This means it is $f=f(C)$ or $C=C(f),$ at least locally.