troubleshooting Question

Displaying Image Based On Field Value

Avatar of DS928
DS928Flag for United States of America asked on
PHP
4 Comments1 Solution201 ViewsLast Modified:
I am trying to display an image based on the value of a field.  I am getting this error.

Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/s/t/dstr3/html/MENUHEAD/Pages/restpage.php:1) in /home/content/d/s/t/dstr3/html/MENUHEAD/Pages/restpage.php on line 427

<?PHP  
If ($Rating == ".5") 
	{
	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/Half.png');
	}
elseif ($Rating == "1")
	{
	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/1Head.png');
	}
elseif ($Rating == "1.5") 
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/1andHalf.png');
	}
elseif ($Rating == "2")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/2Heads.png');
	}
elseif ($Rating == "2.5")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/2andHalf.png');
	}
elseif ($Rating == "3")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/3Heads.png');
	}
elseif ($Rating == "3.5")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/3andHalf.png');
	}
elseif ($Rating == "4")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/4Heads.png');
	}
elseif ($Rating == "4.5")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/4andHalf.png');
	}
elseif ($Rating == "5")
	{
 	header('Content-Type: image/x-png');
	readfile('http://www.menuhead.net/Images/Icons/5Heads.png');
	}
?>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros