fpdf want to change SetFillColor for an array dependent on if/else statement
Ok, will try be as clear as possible here. I am trying to produce a pdf document with various fields that display product information. Essentially, the script that produces the pdf will determine whether a change in the product has been initiated, if it has then the pdf will be created.

What I am trying to do now is highlight the field with those changes. To check whether there are changes I am using the following variables (of which there are about thirty)

    $cone
    $ctwo..... etc

An example of the array for the product output in the PDF file is:

        $leftHeadArray[0]['leftText']  = 'ID';
    	$leftHeadArray[0]['rightText'] = $ID;
    	
    	
    	$leftHeadArray[1]['leftText']  = 'start';
    	$leftHeadArray[1]['rightText'] = date("d/m/Y", $Start);
    	
    	
    	$leftHeadArray[2]['leftText']  = 'End';
    	$leftHeadArray[2]['rightText'] = date("d/m/Y", $End);

The format and cell is then initated below this at:

    $maxheader = max(array_keys($leftHeadArray), array_keys($midHeadArray), array_keys($rightHeadArray));
    	
    	for ($i = 0; $i <= max($maxheader); $i++)
    	{
    		if (isset($leftHeadArray[$i]))
    		{
    			$pdf->SetFont('helvetica', 'B', 6);
    			$pdf->SetFillColor(128, 0, 0);
    			$pdf->SetTextColor(255, 255, 255);
    			
    			$pdf->Cell(40, 5, $leftHeadArray[$i]['leftText'], $border, 0, 'L', 1);
    			
    			$pdf->SetFont('helvetica', 'N', 6);
    			if ($ctwentytwo == 0 && $leftHeadArray[1]['rightText'] || $ctwentytwo == 0 && $leftHeadArray[4]['rightText'] ){
    			$pdf->SetFillColor(255, 255, 255);
    			$pdf->SetTextColor(0, 0, 0);
    			}else{
    			$pdf->SetFillColor(0, 0, 0);
    			$pdf->SetTextColor(255, 255, 255);
    			}
			
			$pdf->Cell(30, 5, $leftHeadArray[$i]['rightText'], $border, 0, 'L', 1);
			$pdf->Cell(20, 5, '', 0, 0, 'L', 0);
		}

**Things I have tried already:**

1. wrapping if else statements around the inidividual cell arrays 

    (e.g. $leftHeadArray[0]['leftText']  = 'ID';
        	$leftHeadArray[0]['rightText'] = $ID;)

 and trying to over-ride the set fill color within there

2. putting the if else statement within the if isset section

**Things I am struggling with:**

 - connecting the $cone to the $leftheadarray 
 - changing just the one cell when a change is initiated

I hope this is concise!
 

fpdf want to change SetFillColor for an array dependent on if/else statement
===

Ok, will try be as clear as possible here. I am trying to produce a pdf document with various fields that display product information. Essentially, the script that produces the pdf will determine whether a change in the product has been initiated, if it has then the pdf will be created.

What I am trying to do now is highlight the field with those changes. To check whether there are changes I am using the following variables (of which there are about thirty)

    $cone
    $ctwo..... etc

An example of the array for the product output in the PDF file is:

        $leftHeadArray[0]['leftText']  = 'ID';
    	$leftHeadArray[0]['rightText'] = $ID;
    	
    	
    	$leftHeadArray[1]['leftText']  = 'start';
    	$leftHeadArray[1]['rightText'] = date("d/m/Y", $Start);
    	
    	
    	$leftHeadArray[2]['leftText']  = 'End';
    	$leftHeadArray[2]['rightText'] = date("d/m/Y", $End);

The format and cell is then initated below this at:

    $maxheader = max(array_keys($leftHeadArray), array_keys($midHeadArray), array_keys($rightHeadArray));
    	
    	for ($i = 0; $i <= max($maxheader); $i++)
    	{
    		if (isset($leftHeadArray[$i]))
    		{
    			$pdf->SetFont('helvetica', 'B', 6);
    			$pdf->SetFillColor(128, 0, 0);
    			$pdf->SetTextColor(255, 255, 255);
    			
    			$pdf->Cell(40, 5, $leftHeadArray[$i]['leftText'], $border, 0, 'L', 1);
    			
    			$pdf->SetFont('helvetica', 'N', 6);
    			if ($ctwentytwo == 0 && $leftHeadArray[1]['rightText'] || $ctwentytwo == 0 && $leftHeadArray[4]['rightText'] ){
    			$pdf->SetFillColor(255, 255, 255);
    			$pdf->SetTextColor(0, 0, 0);
    			}else{
    			$pdf->SetFillColor(0, 0, 0);
    			$pdf->SetTextColor(255, 255, 255);
    			}
			
			$pdf->Cell(30, 5, $leftHeadArray[$i]['rightText'], $border, 0, 'L', 1);
			$pdf->Cell(20, 5, '', 0, 0, 'L', 0);
		}

**Things I have tried already:**

1. wrapping if else statements around the inidividual cell arrays 

    (e.g. $leftHeadArray[0]['leftText']  = 'ID';
        	$leftHeadArray[0]['rightText'] = $ID;)

 and trying to over-ride the set fill color within there

2. putting the if else statement within the if isset section

**Things I am struggling with:**

 - connecting the $cone to the $leftheadarray 
 - changing just the one cell when a change is initiated

I hope this is concise!
 
