In the above picture there are two point charges $q_1$ and $q_2$. $S_1$ and $S_2$ are Gaussian surfaces centred about $q_1$ and $q_2$ respectively. If I want to find the electric field at P, then I have to apply Gauss's law to both the Gaussian surfaces $S_1$ and $S_2$. In other words outside charges can cause there to be an electric field at P even though the flux because of the outside charges is zero on that surface.
But when calculating the field inside a uniformly charged sphere, we completely neglect the outside charges(outside the Gaussian surface but still inside the sphere). I know that is because of Newton's shell theorem but E&M books do not mention this. They just go with Gauss's law.
Consider the example-4 in chapter 2 in Introduction to Electrodynamics by Griffiths
The problem statement is as follows:
A long cylinder (Fig .21) carries a charge density that is proportional to the distance from the axis $\rho = ks$, for some constant k. Find the electric field inside the cylinder.
In the solution for the problem, he finds the field of a cylindrical gaussian surface in a larger coaxial cylinder using a gauss theorem. This field is said to be the electric field inside the cylinder but the gauss theorem doesn't really consider the field due to the charges between the gaussian cylinder and the outer cylinder. Hence, it must not be the 'total' field which we have found. So, my question is what exactly does Griffith mean when he says 'the electric field'?
Edit: Suppose I applied Gauss law on the surface $S_1$. If the field due to $q_1$ and $q_2$ are $E_1$ and $E_2$, then $$\oint \mathbf{E} \cdot \mathbf{da} = \frac{q_1}{\epsilon_0}$$ $$\oint \mathbf{E_1} \cdot \mathbf{da} + \oint \mathbf{E_2} \cdot \mathbf{da} = \frac{q_1}{\epsilon_0}$$ The second integral vanishes and so I get $$E_1 \oint da = \frac{q_1}{\epsilon_0}$$ What I get is the magnitude of the electric field due to the charge enclosed but that is not the total electric field at P. The total electric field at P has magnitude $|\mathbf{E_1} + \mathbf{E_2}|$.
I can use the same argument for the Griffith's example. If $\mathbf{E_i}$ and $\mathbf{E_o}$ are due to the inside and outside charges, then what Griffith's solved for is the magnitude of $\mathbf{E_i}$ because $$E_i \oint da + \oint \mathbf{E_o} \cdot \mathbf{da}\text{ ( = 0) } = \frac{\int \rho dV }{\epsilon_0}$$ would give me the same value of electric field as Griffiths got. But that is not the net electric field at that point. The magnitude of the net electric field at that point is $|\mathbf{E_i} + \mathbf{E_o}|$. But in problems like this, the field we get from Gauss's law is simply referred to as the electric field as if it's the net electric field. The only way it is the electric field at that point is if the contributions from the outside charges cancel out. That would be true for something with spherical symmetry because of Newton's shell theorem, but how would that be true for something with cylindrical symmetry like in the Griffiths example?