jeudi 14 janvier 2021

$this->Image inside PHP if statement [closed]

For FPDF I am trying to either add php variables inside a background image...

e.g.

    //BACKGROUND
 if (strpos($Result, '1') !== false) {
 $Background = 'images/Cert-Sample-1.jpg';
 } else if (strpos($Result, '2') !== false) {
 $Background = 'images/Cert-Sample-2.jpg';
 } else if (strpos($Result, '3') !== false) {
 $Background = 'images/Cert-Sample-3.jpg';
 }

    $this->Image($Background,0,0,0,300);

or by puting the background setting inside the if statements

    //BACKGROUND
 if (strpos($Result, '1') !== false) {
    $this->Image('images/Cert-Sample-1.jpg',0,0,0,300);
 } else if (strpos($Result, '2') !== false) {
    $this->Image('images/Cert-Sample-2.jpg',0,0,0,300);
 } else if (strpos($Result, '3') !== false) {
    $this->Image('images/Cert-Sample-3.jpg',0,0,0,300);
 }

But neither seems to work.

Any thoughts?

Thanks

Aucun commentaire:

Enregistrer un commentaire