We investigate the existence and nonexistence of solutions to the Dirichlet problem where \(\Omega \subset \mathbb {R}^N\) is a smooth bounded domain, \(p\in (1,\infty )\) , \(\lambda >0\) and \(g\in C(\mathbb {R})\) . Our main assumption is that \(f:\mathbb {R}\rightarrow \mathbb {R}\) is a continuous function such that \(f(s)>0\) for all \(s\in (\alpha ,\beta )\) , where \(0<\alpha <\beta \) are two zeros of f. If \(f(0)\ge 0\) , we show that an area condition involving f and g is both sufficient and necessary in order to have a pair \((\lambda ,u)\in \mathbb {R}^+\times {C^1_0(\overline{\Omega })}\) , with \(u\ge 0\) and \(\Vert u\Vert _{C(\overline{\Omega })}\in (\alpha ,\beta ]\) , solving (P). We also study how the presence of the gradient term affects the existence of solution. Roughly speaking, the more negative g is, the stronger its regularizing effect on (P). We prove that, regardless of the shape of f, for any fixed \(\lambda \) , there always exists a function g such that (P) admits a nonnegative solution with maximum in \((\alpha ,\beta ]\) .