Answer
$T=mgsin\theta$
Work Step by Step
We can find the required formula for tension as follows:
The horizontal component of weight is $W_x=Wsin\theta$
and the horizontal component of force is given as $F_x=T-W_x$
$\implies F_x=T-Wsin\theta$
But the horizontal force is zero
$\implies T=Wsin\theta$
$\implies T=mgsin\theta$
Now we check for $\theta=0^{\circ}$
$T=mgsin(0^{\circ})=0$
and $\theta=90^{\circ}$
$T=mgsin(90^{\circ})=mg$