Consider the map $\varphi:C[0,1]\to\mathbb{R}$ given by
$g\mapsto \int_0^1 g(t)f(t)\; dt$
It's easy to see that this map is a continuous linear functional when $C[0,1]$ is given the $\|\cdot\|_\infty$ norm. Note then that by applying the hypothesis you can show that $\mathbb{R}[x]\subseteq\ker\varphi$, but since $\mathbb{R}[x]$ is dense in $C[0,1]$ this implies that $\varphi=0$. Take $g=f$ then to conclude that $f=0$.
EDIT: As Michael Hardy points out, I should probably mention that the density of $\mathbb{R}[x]$ in $(C[0,1],\|\cdot\|_\infty)$ is precisely the statement of the Stone-Weierstrass theorem.
EDIT EDIT: As Pete. L Clark points out, we don't need the complexity of the Stone-Weierstrass theorem (which deals with $C(X)$ for $X$ l.c. Hausdorff) we really only need the special case of $[a,b]$ and the subalgebra being polynomials--this is the Weierstrass Approximation Theorem. This particular case is much easier than the general Stone-Weierstrass theorem. There is a constructive proof using Bernstein polynomials--a Numerical Analysis approximant that has the advantage of approximating a huge class of functions (at least the continuous ones) but with the downside of the rate of convergence being sublinear.