If we construct the gaussian surface as shown (cylinder with one of the discs in the negatively charged plate of the capacitor) and the field at P is to be calculated, then as the total charge within the surface is zero so total flux will be zero. And the electric field is at all points normal to the plane of the plates of the infinitely long capacitor and also the discs of the cylinder, so the electric field at P must be zero, but P is closer to the positively charged plate and thus an outward electric field must be present at P. I am unable to resolve this contradiction, any help will be appreciated.
An infinite big plate creates an uniform electric field perpendicular to it. This means that no matter how close or how far you are from that plate, you measure the same electric field.
Thus, when you put two opposite charged plates to form a capacitor, the fields between the plates will be directed the same way and this means that you have a non zero electric field in the inside, while the fields outside the plates will cancel out and you have a null electric field outside.