The statement is an if and only if. So, first prove one direction, then the other. To prove the first direction, assume that E is an interval. Then show that it follows that every continuous real-valued function on E has an interval as its image.
Do you need help with that proof? To get you started: If the function is a constant function, then it is trivially true, as every constant can be expressed as the interval .
Next, assume that every continuous real-valued function on E has an interval as its image. Try to prove that E is an interval. This should be trivial to prove. Hint: Let be the identity function.