Jump to content

PHP Function Help


tebrown

Recommended Posts

Hey Guys,

 

I have just created a function where it determines a team color for their profile. Take a look at the photo for an example. This shows their team color next to their names.

 

What im trying to do now is to determine of this player is injured or not. If the player is injured it will replace the team color for the specific person to red.

 

I have given it a go but its not working as expected.

 

Here is the function:

 

function teamcolor($color, $injured) {

   if ($color == 'Senior As') {
      echo "<div style='height: 100%; width: 3px; background-color: #DDAB5B;'>";
   }

   if ($color == 'Colts U21s') {
      echo "<div style='height: 100%; width: 3px; background-color: #C492F4;'>";
   }
   
   if ($color == 'Senior Bs') {
         echo "<div style='height: 100%; width: 3px; background-color: #7BCBEF;'>"; 
      } 
   
   else if ($injured=='1') { 
      echo "<div style='height: 100%; width: 3px; background-color: #cc1717;'>"; }

}

 

Calling the function:

 

<?php  echo teamcolor($color, $injured); ?>

post-132578-1348240376865_thumb.png

Link to comment
Share on other sites

Would this be appropriate?

 

function teamcolor($color, $injured) {

if ($injured == '1') {
		echo "<div style='height: 100%; width: 3px; background-color: red;'>";
	} else if ($color == 'Senior As') {
			echo "<div style='height: 100%; width: 3px; background-color: #DDAB5B;'>";
		} 	else if ($color == 'Senior Bs') {
					echo "<div style='height: 100%; width: 3px; background-color: green;'>";
				} 	else if ($color == 'Colts U21s') {
								echo "<div style='height: 100%; width: 3px; background-color: blue;'>";
							}

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.